diff options
author | Matthias Wolf <matthias.wolf@epfl.ch> | 2023-02-07 04:12:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-06 19:12:30 -0800 |
commit | a7f39da5db501eec1574c38fa9505c0be349224d (patch) | |
tree | c7391442bc371c2d89f4fe01640161d50f6d64ec /lib | |
parent | 1d3a74d926d86f3594f22f9ea4911a4eaebe4137 (diff) | |
download | spack-a7f39da5db501eec1574c38fa9505c0be349224d.tar.gz spack-a7f39da5db501eec1574c38fa9505c0be349224d.tar.bz2 spack-a7f39da5db501eec1574c38fa9505c0be349224d.tar.xz spack-a7f39da5db501eec1574c38fa9505c0be349224d.zip |
Fix path handling in prefix inspections (#35318)
At least with ZSH, prefix inspections containing `./bin` result in a
`$PREFIX/./bin` and result in strange `$PATH` handling.
I.e., `module load git` will prepend `/path/to/git/./bin`, `which git`
will find the right executable, but `git --version` will print the
system one. Normalize the relative path to avoid this behavior.
See also spack/spack#31867.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/util/environment.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py index e6c650d6cf..1f019cbbab 100644 --- a/lib/spack/spack/util/environment.py +++ b/lib/spack/spack/util/environment.py @@ -912,7 +912,7 @@ def inspect_path(root, inspections, exclude=None): env = EnvironmentModifications() # Inspect the prefix to check for the existence of common directories for relative_path, variables in inspections.items(): - expected = os.path.join(root, relative_path) + expected = os.path.join(root, os.path.normpath(relative_path)) if os.path.isdir(expected) and not exclude(expected): for variable in variables: |