Cray bugfix: TERM missing while reading default target#15381
Cray bugfix: TERM missing while reading default target#15381
Conversation
lib/spack/spack/platforms/cray.py
Outdated
| env = which('env') | ||
| output = env("-i", "/bin/bash", "-lc", "echo $CRAY_CPU_TARGET", | ||
| output = env("-i", "TERM=%s" % os.environ['TERM'], | ||
| "/bin/bash", "-lc", "echo $CRAY_CPU_TARGET", |
There was a problem hiding this comment.
Can we do this in a slightly less complex way without relying on env?
bash = Executable("/bin/bash")
bash("-lc", "echo", "$CRAY_CPU_TARGET",
env={"TERM": os.environ["TERM"]})
lib/spack/spack/platforms/cray.py
Outdated
| if _target is None and name == 'back_end': | ||
| _target = self._default_target_from_env() | ||
| if _target is not None: | ||
| if _target: |
There was a problem hiding this comment.
What real case is this change handling?
There was a problem hiding this comment.
_default_target_from_env can return whitespace.
There was a problem hiding this comment.
I think we should fix that in _default_target_from_env instead of here.
There was a problem hiding this comment.
I think this is clearer and more pythonic. I went back and forth on this.
_default_target_from_env runs a bash command and parses the output. If it gets anything, that's the target, if not, additional logic.
There was a problem hiding this comment.
I do not think _default_target_from_env should return whitespace for failure -- can it really return whitespace or None?
There was a problem hiding this comment.
It can't return None currently. It has to return a string.
There was a problem hiding this comment.
Reworked so it returns None, but I don't think this is an improvement.
Bug: Spack hangs on some Cray machines Reason: The TERM environment variable is necessary to run bash -lc "echo $CRAY_CPU_TARGET", but we run that command within env -i, which wipes the environment. Fix: Manually forward the TERM environment variable to env -i /bin/bash -lc "echo $CRAY_CPU_TARGET"
…upstream_master * commit 'e2b1737a42c9c0c796671f9dd0c39f623e4c91c0': (1343 commits) update CHANGELOG.md for 0.14.1 version bump: 0.14.1 multiprocessing: allow Spack to run uninterrupted in background (spack#14682) Cray bugfix: TERM missing while reading default target (spack#15381) Upstreams: don't write metadata directory to upstream DB (spack#15526) Creating versions from urls doesn't modify class attributes (spack#15452) bugfix: fix install_missing_compilers option bug from v0.14.0 (spack#15416) bugfix: installer.py shouldn't be executable (spack#15386) Add function replace_prefix_nullterm for use on mach-o rpaths. (spack#15347) ArchSpec: fix semantics of satisfies when not concrete and strict is true (spack#15319) suite-sparse: fix installation for v5.X (spack#15326) testing: increase installer coverage (spack#15237) bugfix: resolve undefined source_pkg_dir failure (spack#15339) Bugfix: resolve StopIteration message attribute failure (spack#15341) Recover coverage from subprocesses during unit tests (spack#15354) Correct pytest.raises matches to match (spack#15346) bugfix: Add dependents when initializing spec from yaml (spack#15220) Uniquify suffixes added to module names (spack#14920) bugfix: ensure proper dependency handling for package-only installs (spack#15197) Fix for being able to 'spack load' packages that have been renamed. (spack#14348) ... # Conflicts: # .travis.yml # lib/spack/spack/modules/common.py # var/spack/repos/builtin/packages/mofem-cephas/package.py # var/spack/repos/builtin/packages/mofem-fracture-module/package.py # var/spack/repos/builtin/packages/mofem-users-modules/package.py # var/spack/repos/builtin/packages/python/package.py
Bug: Spack hangs on some Cray machines
Reason: The
TERMenvironment variable is necessary to runbash -lc "echo $CRAY_CPU_TARGET", but we run that command withinenv -i, which wipes the environment.Fix: Manually forward the
TERMenvironment variable toenv -i /bin/bash -lc "echo $CRAY_CPU_TARGET"