From 767be88c1d6fcf945a365a7b186e5d1b2886234c Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 28 Feb 2019 14:24:27 +0100 Subject: [PATCH] from_sourcing_file: fixed a bug + added a few ignored variables closes #7536 Credits for this change goes to @mgsternberg (original author of #7536) The new variables being ignored are specific to Modules v4. --- lib/spack/spack/util/environment.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py index 1666f4711e3609..6eab6d316e50e2 100644 --- a/lib/spack/spack/util/environment.py +++ b/lib/spack/spack/util/environment.py @@ -446,7 +446,12 @@ def from_sourcing_file(filename, *args, **kwargs): for k, v in env_after.items()) # Other variables unrelated to sourcing a file - blacklist.extend(['SHLVL', '_', 'PWD', 'OLDPWD', 'PS2']) + blacklist.extend([ + # Bash internals + 'SHLVL', '_', 'PWD', 'OLDPWD', 'PS2', 'ENV', + # Environment modules v4 + 'LOADEDMODULES', '_LMFILES_', 'BASH_FUNC_module()' + ]) def set_intersection(fullset, *args): # A set intersection using string literals and regexs