Skip to content

Commit

Permalink
issue #331: Allow pushenv("FOO", false) to clear "FOO"
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Nov 16, 2017
1 parent 96b8b65 commit d249821
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 11 deletions.
2 changes: 2 additions & 0 deletions README.new
Original file line number Diff line number Diff line change
Expand Up @@ -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)

12 changes: 10 additions & 2 deletions rt/pushenv/err.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 [email protected]
===========================
step 2
Expand Down Expand Up @@ -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
1 change: 1 addition & 0 deletions rt/pushenv/mf/Core/lloyd/1.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pushenv("LLOYD",false)
41 changes: 40 additions & 1 deletion rt/pushenv/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,53 @@ __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";
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";
Expand Down
8 changes: 6 additions & 2 deletions rt/pushenv/pushenv.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions src/MasterControl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"}
Expand Down
4 changes: 2 additions & 2 deletions src/joinBase64Results
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d249821

Please sign in to comment.