Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rez env seems to mangle the PATH #1888

Open
czerouni opened this issue Dec 5, 2024 · 4 comments
Open

Rez env seems to mangle the PATH #1888

czerouni opened this issue Dec 5, 2024 · 4 comments
Labels

Comments

@czerouni
Copy link

czerouni commented Dec 5, 2024

We have been chasing something related to the PATH environment variable, which is seemingly manipulated in a non-obvious way as Rez sets up the environment. To create the simplest demonstration of this, I opened a fresh shell and printed the PATH variable. Then I ran rez env with no packages at all, and inspect the PATH - it has extra entries added, and has rearranged the order of others.

Environment

  • OS - rocky9
  • Rez version 3.1.1
  • Rez python version3.9.16

To Reproduce
Here is the before and after.

Before

$ printenv PATH
/local/prod/laika/common/CURRENT/bin/python
/home/c/czerouni/.local/bin
/usr/share/Modules/bin
/usr/local/bin
/usr/bin
/bin
/sbin
/usr/local/sbin
/usr/sbin
/opt/puppetlabs/bin
/opt/puppetlabs/bin
/laika/dist/bin
/laika/dist/third_party/linux_rocky9_x86_64/rez/RELEASE/bin/rez
/opt/puppetlabs/bin

then

$ rez env
$ printenv PATH
/usr/share/Modules/bin
.
/laika/dist/third_party/linux_rocky9_x86_64/rez/RELEASE/bin/rez
/sbin
/usr/sbin
/usr/local/sbin
/opt/puppetlabs/bin
/bin
/usr/bin
/net/ent-prod.nfs.laika.com/ifs/laika/dist/third_party/linux_rocky9_x86_64/rez/v3.1.1/bin/rez

Expected behavior
What I would expect is for the PATH to be identical to what it was before I ran rez env, because no packages were loaded that would modify it.

Actual behavior
See the example. Notice that '.' is in the path, when it wasn't before, and that many of the paths have been reordered. And laika/dist/bin is missing completely.

@czerouni czerouni added the bug label Dec 5, 2024
@maxnbk
Copy link
Contributor

maxnbk commented Dec 5, 2024

The value of some items in your rez-config will be important to inspect to provide any analysis, for example, parent_variables, resetting_variables, and rez_tools_visibility, as well as standard_system_paths. Better to share your config in its entirety, with anything you need anonymized just mangled/scrubbed.

@czerouni
Copy link
Author

czerouni commented Dec 5, 2024

Makes sense. Here it is - it is 99.9% default values
laika_rezconfig.txt

BTW, I tried this on CentOS-7 and it did the same thing, but differently - the PATH was messed up in different ways.

@maxnbk
Copy link
Contributor

maxnbk commented Dec 6, 2024

Is there anything special in the package.py's for your implicit packages? e.g. your linux/arch/rocky/centos etc packages that are being used as your implicits?
If so, perhaps do another rez-env PATH test, with --no-implicits and see if it's the same.

The first thing I can identify, is that the last entry in the "after" is correct because you have rez_tools_visibility = "append", so the rez tools will get added as the last thing, allowing you to use rez-tools inside your rez-env's.

@czerouni
Copy link
Author

czerouni commented Dec 6, 2024

Hey. No, I checked that earlier - none of those implicit packages do anything - they don't even have a commands() section. And doing rez env --ni yields the same result as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants