diff --git a/README.new b/README.new index 95399c8ae..c8727ca37 100644 --- a/README.new +++ b/README.new @@ -26,3 +26,5 @@ Lmod 7.7+ caused problems for some users when interacting with TCL. (7.7.14) Do not look for lua_json. Just use the one that comes with Lmod. Fix sh_to_modulefile correctly handle bad options (issue #332) + Allow pushenv("FOO",false) to clear "FOO" (issue #331) + diff --git a/rt/pushenv/err.txt b/rt/pushenv/err.txt index 4643eb414..8674a6bdc 100644 --- a/rt/pushenv/err.txt +++ b/rt/pushenv/err.txt @@ -2,7 +2,7 @@ step 1 lua ProjectDIR/src/lmod.in.lua bash --regression_testing --version =========================== -Modules based on Lua: Version 7.6.12 2017-09-01 18:59 -05:00 +Modules based on Lua: Version 7.7.13 2017-10-31 10:46 -05:00 by Robert McLay mclay@tacc.utexas.edu =========================== step 2 @@ -78,11 +78,19 @@ lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload ll/2.0 =========================== =========================== step 19 +lua ProjectDIR/src/lmod.in.lua bash --regression_testing load lloyd +=========================== +=========================== +step 20 +lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload lloyd +=========================== +=========================== +step 21 lua ProjectDIR/src/lmod.in.lua bash --regression_testing save =========================== Saved current collection of modules to: "default" =========================== -step 20 +step 22 lua ProjectDIR/src/lmod.in.lua bash --regression_testing restore =========================== Restoring modules from user's default diff --git a/rt/pushenv/mf/Core/lloyd/1.0.lua b/rt/pushenv/mf/Core/lloyd/1.0.lua new file mode 100644 index 000000000..9e05d0e2f --- /dev/null +++ b/rt/pushenv/mf/Core/lloyd/1.0.lua @@ -0,0 +1 @@ +pushenv("LLOYD",false) diff --git a/rt/pushenv/out.txt b/rt/pushenv/out.txt index f85ed65d2..1b0ef6b8d 100644 --- a/rt/pushenv/out.txt +++ b/rt/pushenv/out.txt @@ -348,6 +348,45 @@ __LMOD_STACK_RTM="test"; export __LMOD_STACK_RTM; =========================== step 19 +lua ProjectDIR/src/lmod.in.lua bash --regression_testing load lloyd +=========================== +unset LLOYD; +__LMOD_REF_COUNT_LOADEDMODULES="intel/13.0:1;mpich/3.0:1;lloyd/1.0:1"; +export __LMOD_REF_COUNT_LOADEDMODULES; +LOADEDMODULES="intel/13.0:mpich/3.0:lloyd/1.0"; +export LOADEDMODULES; +MODULEPATH="ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0:ProjectDIR/rt/pushenv/mf/Core"; +export MODULEPATH; +__LMOD_REF_COUNT__LMFILES_="ProjectDIR/rt/pushenv/mf/Core/intel/13.0.lua:1;ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0/mpich/3.0.lua:1;ProjectDIR/rt/pushenv/mf/Core/lloyd/1.0.lua:1"; +export __LMOD_REF_COUNT__LMFILES_; +_LMFILES_="ProjectDIR/rt/pushenv/mf/Core/intel/13.0.lua:ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0/mpich/3.0.lua:ProjectDIR/rt/pushenv/mf/Core/lloyd/1.0.lua"; +export _LMFILES_; +_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={intel={["fn"]="ProjectDIR/rt/pushenv/mf/Core/intel/13.0.lua",["fullName"]="intel/13.0",["loadOrder"]=1,propT={},["stackDepth"]=0,["status"]="active",["userName"]="intel",},lloyd={["fn"]="ProjectDIR/rt/pushenv/mf/Core/lloyd/1.0.lua",["fullName"]="lloyd/1.0",["loadOrder"]=3,propT={},["stackDepth"]=0,["status"]="active",["userName"]="lloyd",},mpich={["fn"]="ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0/mpich/3.0.lua",["fullName"]="mpich/3.0",["loadOrder"]=2,propT={},["stackDepth"]=0,["status"]="active",["userName"]="mpich",},},mpathA={"ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0","ProjectDIR/rt/pushenv/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/pushenv/mf/Core",}'; +export _ModuleTable_; +__LMOD_STACK_LLOYD="false:FOO"; +export __LMOD_STACK_LLOYD; +=========================== +step 20 +lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload lloyd +=========================== +LLOYD="FOO"; +export LLOYD; +__LMOD_REF_COUNT_LOADEDMODULES="intel/13.0:1;mpich/3.0:1"; +export __LMOD_REF_COUNT_LOADEDMODULES; +LOADEDMODULES="intel/13.0:mpich/3.0"; +export LOADEDMODULES; +MODULEPATH="ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0:ProjectDIR/rt/pushenv/mf/Core"; +export MODULEPATH; +__LMOD_REF_COUNT__LMFILES_="ProjectDIR/rt/pushenv/mf/Core/intel/13.0.lua:1;ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0/mpich/3.0.lua:1"; +export __LMOD_REF_COUNT__LMFILES_; +_LMFILES_="ProjectDIR/rt/pushenv/mf/Core/intel/13.0.lua:ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0/mpich/3.0.lua"; +export _LMFILES_; +_ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={intel={["fn"]="ProjectDIR/rt/pushenv/mf/Core/intel/13.0.lua",["fullName"]="intel/13.0",["loadOrder"]=1,propT={},["stackDepth"]=0,["status"]="active",["userName"]="intel",},mpich={["fn"]="ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0/mpich/3.0.lua",["fullName"]="mpich/3.0",["loadOrder"]=2,propT={},["stackDepth"]=0,["status"]="active",["userName"]="mpich",},},mpathA={"ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0","ProjectDIR/rt/pushenv/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/pushenv/mf/Core",}'; +export _ModuleTable_; +__LMOD_STACK_LLOYD="FOO"; +export __LMOD_STACK_LLOYD; +=========================== +step 21 lua ProjectDIR/src/lmod.in.lua bash --regression_testing save =========================== MODULEPATH="ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0:ProjectDIR/rt/pushenv/mf/Core"; @@ -355,7 +394,7 @@ export MODULEPATH; _ModuleTable_='_ModuleTable_={["MTversion"]=3,depthT={},family={},mT={intel={["fn"]="ProjectDIR/rt/pushenv/mf/Core/intel/13.0.lua",["fullName"]="intel/13.0",["loadOrder"]=1,propT={},["stackDepth"]=0,["status"]="active",["userName"]="intel",},mpich={["fn"]="ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0/mpich/3.0.lua",["fullName"]="mpich/3.0",["loadOrder"]=2,propT={},["stackDepth"]=0,["status"]="active",["userName"]="mpich",},},mpathA={"ProjectDIR/rt/pushenv/mf/Compiler/intel/13.0","ProjectDIR/rt/pushenv/mf/Core",},["systemBaseMPATH"]="ProjectDIR/rt/pushenv/mf/Core",}'; export _ModuleTable_; =========================== -step 20 +step 22 lua ProjectDIR/src/lmod.in.lua bash --regression_testing restore =========================== CC="mpicc"; diff --git a/rt/pushenv/pushenv.tdesc b/rt/pushenv/pushenv.tdesc index 8f63f3bcb..fab54c12e 100644 --- a/rt/pushenv/pushenv.tdesc +++ b/rt/pushenv/pushenv.tdesc @@ -45,8 +45,12 @@ testdescript = { runLmod load ll/2.0 #17 runLmod unload ll/2.0 #18 - runLmod save #19 - runLmod restore #20 + export LLOYD="FOO" + runLmod load lloyd #19 + runLmod unload lloyd #20 + + runLmod save #21 + runLmod restore #22 HOME_ORIG=$HOME diff --git a/src/MasterControl.lua b/src/MasterControl.lua index 2cf1cdc14..60de444d7 100644 --- a/src/MasterControl.lua +++ b/src/MasterControl.lua @@ -266,9 +266,13 @@ function M.pushenv(self, name, value) varT[stackName] = Var:new(stackName, v64, nodups, ":") end - - v = tostring(value) - v64 = encode64(value) + if (value == false) then + v = false + v64 = "false" + else + v = tostring(value) + v64 = encode64(value) + end local priority = 0 varT[stackName]:prepend(v64, nodups, priority) @@ -303,7 +307,9 @@ function M.popenv(self, name, value) local v64 = varT[stackName]:pop() local v = nil - if (v64) then + if (v64 == "false") then + v = false + elseif (v64) then v = decode64(v64) end dbg.print{"v: ", v,"\n"} diff --git a/src/joinBase64Results b/src/joinBase64Results index 95b304ad7..835670e67 100755 --- a/src/joinBase64Results +++ b/src/joinBase64Results @@ -172,7 +172,7 @@ function joinMT_bash(whole) b[#b+1] = name b[#b+1] = "=\"" for v in str:split(":") do - v = decode64(v) + v = (v ~= "false") and decode64(v) or "false" b[#b+1] = v b[#b+1] = ":" end @@ -209,7 +209,7 @@ function joinMT_csh(whole) b[#b+1] = name b[#b+1] = " \"" for v in str:split(":") do - v = decode64(v) + v = (v ~= "false") and decode64(v) or "false" b[#b+1] = v b[#b+1] = ":" end