Cray bugfix: TERM missing while reading default target (#15381)
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"
This commit is contained in:
parent
a61c53a5c9
commit
e5f8b093a9
@ -7,7 +7,7 @@
|
|||||||
import re
|
import re
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from spack.paths import build_env_path
|
from spack.paths import build_env_path
|
||||||
from spack.util.executable import which
|
from spack.util.executable import Executable
|
||||||
from spack.architecture import Platform, Target, NoPlatformError
|
from spack.architecture import Platform, Target, NoPlatformError
|
||||||
from spack.operating_systems.cray_frontend import CrayFrontend
|
from spack.operating_systems.cray_frontend import CrayFrontend
|
||||||
from spack.operating_systems.cnl import Cnl
|
from spack.operating_systems.cnl import Cnl
|
||||||
@ -117,11 +117,13 @@ def _default_target_from_env(self):
|
|||||||
'''
|
'''
|
||||||
# env -i /bin/bash -lc echo $CRAY_CPU_TARGET 2> /dev/null
|
# env -i /bin/bash -lc echo $CRAY_CPU_TARGET 2> /dev/null
|
||||||
if getattr(self, 'default', None) is None:
|
if getattr(self, 'default', None) is None:
|
||||||
env = which('env')
|
output = Executable('/bin/bash')('-lc', 'echo $CRAY_CPU_TARGET',
|
||||||
output = env("-i", "/bin/bash", "-lc", "echo $CRAY_CPU_TARGET",
|
env={'TERM': os.environ['TERM']},
|
||||||
output=str, error=os.devnull)
|
output=str, error=os.devnull)
|
||||||
self.default = output.strip()
|
output = ''.join(output.split()) # remove all whitespace
|
||||||
tty.debug("Found default module:%s" % self.default)
|
if output:
|
||||||
|
self.default = output
|
||||||
|
tty.debug("Found default module:%s" % self.default)
|
||||||
return self.default
|
return self.default
|
||||||
|
|
||||||
def _avail_targets(self):
|
def _avail_targets(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user