You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kudos to @albestro for reporting the issue and helping debug it
Summary
Config scopes cannot be trusted when -C and -e are used together on the command line. The issue has been introduced in #50853 and is really nasty for two reasons:
When -C and -e are used together, Spack silently shuffles the config scopes in the middle of execution. The environment scope might be swapped with some other custom scope. Due to the mechanics involved this is also difficult to debug, since the output of spack config get/blame cannot be trusted.
There is no clear error message, just weird observed behavior that doesn't match:
the documentation
the output of spack config blame
The report above has been obtained with trial and error + a debugger. The original issue was reported because some modifications in a custom repository added at environment scope were not taken into account correctly.
Steps to reproduce
Kudos to @albestro for reporting the issue and helping debug it
Summary
Config scopes cannot be trusted when
-Cand-eare used together on the command line. The issue has been introduced in #50853 and is really nasty for two reasons:-Cand-eare used together, Spack silently shuffles the config scopes in the middle of execution. The environment scope might be swapped with some other custom scope. Due to the mechanics involved this is also difficult to debug, since the output ofspack config get/blamecannot be trusted.Why are the scopes shuffled?
Since #50853 was merged, environments added from the command line are considered at CUSTOM priority:
spack/lib/spack/spack/main.py
Lines 901 to 905 in e250ec0
When the environment is loaded, we use a context manager:
spack/lib/spack/spack/environment/environment.py
Lines 999 to 1004 in e250ec0
that adds the environment at ENVIRONMENT priority:
spack/lib/spack/spack/environment/environment.py
Lines 3035 to 3039 in e250ec0
The result is that config scopes are swapped in the middle of execution, and user might see unexpected behaviors.
Minimal reproducer
This can be reproduced easily with the following setup:
The files are the following:
Then we can run the script like:
and see the swapping in action 😞
Error message
There is no clear error message, just weird observed behavior that doesn't match:
spack config blameThe report above has been obtained with trial and error + a debugger. The original issue was reported because some modifications in a custom repository added at environment scope were not taken into account correctly.
Information on your system
@tgamblin @kwryankrattiger
General information
spack debug reportand reported the version of Spack/Python/Platform