Closed wolfv closed 13 hours ago
Looks like we're only storing a single path in the trampoline JSON which isn't the correct one:
/// Root path of the original executable that should be prepended to the PATH.
pub path: PathBuf,
I think we should change that to store the prefix: PathBuf
, and then derive the correct PATH in the trampoline code by copying over the bits from the activation.
Yep I think youre correct.
This changes the trampoline config by adding a field path_variables
that will be prepended to the actual path. This includes the folders that were added by the (cached) activation.
We also currently store the path
that is the parent path of the executable. We don't really need that variable anymore. However, for the migration we might still need to parse it - I didn't check the internals of the bin discovery enough - maybe @Hofer-Julian you can review.
I would prefer to store the path to the prefix (not the bin
directory) in a prefix: PathBuf
variable.
Also to clarify the goals:
This should keep "dynamic" path things working (still a bit different than real executables though because the top-paths will always be from the environment). And it should also keep activation scripts that add to the PATH working (like the dotnet
one).
The current behavior is like this:
export PATH="/foo/bar/:$PATH"
python -c "import os; print(os.environ['PATH'])"
Should now print "/home/user/.pixi/envs/python/bin/:/foo/bar/:...rest of PATH..."
I think to match user expectations perfectly, we would figure out what PATH were added completely dynamically but I don't know how to do that. We could record the PATH at creation time and do a dynamic diff, potentially, but it migth also have pitfalls ...
Closing this in favor of https://github.com/prefix-dev/pixi/pull/2541
We almost did the right thing, but then the env var was overwritten again because we also store the PATH as part of the
env
vars in the dictionary in JSON trampoline.However, I am not sure that this works correctly on Windows. On my macBook, the trampoline JSON contains:
The
path
is the correct, single entry on unix systems. On Windows, we need to add 5 paths to the PATH variable https://github.com/conda/rattler/blob/32eefc87ef0f1bc5bcc0bb65183b97e71808f54c/crates/rattler_shell/src/activation.rs#L277-L290Maybe @baszalmstra can quickly check if we need to correct the code for Windows?