Skip to content

Commit

Permalink
Bug fix for prepend/append path with "" for LD_LIBRARY_PATH, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Jun 11, 2024
1 parent f0e0954 commit 7114347
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 23 deletions.
22 changes: 17 additions & 5 deletions rt/spider/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 shell --regression_testing --version
===========================
Modules based on Lua: Version 8.7.37 2024-03-17 13:11 -06:00
Modules based on Lua: Version 8.7.39 2024-06-02 12:29 -05:00
by Robert McLay [email protected]
===========================
step 2
Expand Down Expand Up @@ -905,6 +905,18 @@ must specify the version if there is more than one version:
$ module spider Foo/11.1
===========================
step 73
lua ProjectDIR/src/lmod.in.lua shell --regression_testing spider
===========================
The following is a list of the modules and extensions currently available:
visit: visit/3.1.2
To learn more about a package execute:
$ module spider Foo
where "Foo" is the name of a module.
To find detailed information about a particular package you
must specify the version if there is more than one version:
$ module spider Foo/11.1
===========================
step 74
lua ProjectDIR/src/lmod.in.lua shell --regression_testing avail
===========================
Global Aliases
Expand All @@ -921,23 +933,23 @@ If the avail list is too long consider trying:
Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
===========================
step 74
step 75
lua ProjectDIR/src/lmod.in.lua shell --regression_testing spider Appl1
===========================
Appl1: Appl1/1
You will need to load all module(s) on any one of the lines below before the "Appl1/1" module is available to load.
init-cluster/1.0 MyStack/2021
init-cluster/1.0 MyStack/2022
===========================
step 75
step 76
lua ProjectDIR/src/lmod.in.lua shell --regression_testing spider Appl1
===========================
Appl1: Appl1/1
You will need to load all module(s) on any one of the lines below before the "Appl1/1" module is available to load.
init-cluster/1.0 MyStack/2021
init-cluster/1.0 MyStack/2022
===========================
step 76
step 77
lua ProjectDIR/src/lmod.in.lua shell --regression_testing avail
===========================
Global Aliases
Expand All @@ -952,7 +964,7 @@ If the avail list is too long consider trying:
Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
===========================
step 77
step 78
lua ProjectDIR/src/lmod.in.lua shell --regression_testing avail
===========================
Global Aliases
Expand Down
4 changes: 4 additions & 0 deletions rt/spider/mf6/Core/visit/3.1.2.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
prepend_path("LD_LIBRARY_PATH","")
prepend_path("LD_LIBRARY_PATH","")
prepend_path("LD_LIBRARY_PATH","/path/to/lib")

18 changes: 14 additions & 4 deletions rt/spider/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1546,6 +1546,16 @@ _ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"Pro
export _ModuleTable_;
===========================
step 73
lua ProjectDIR/src/lmod.in.lua shell --regression_testing spider
===========================
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/spider/mf6/Core:1;
export __LMOD_REF_COUNT_MODULEPATH;
MODULEPATH=ProjectDIR/rt/spider/mf6/Core;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/spider/mf6/Core",},systemBaseMPATH="ProjectDIR/rt/spider/mf6/Core",}';
export _ModuleTable_;
===========================
step 74
lua ProjectDIR/src/lmod.in.lua shell --regression_testing avail
===========================
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/spider/mf3/system:1\;ProjectDIR/rt/spider/mf3/init-modules:1;
Expand All @@ -1555,23 +1565,23 @@ export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/spider/mf3/system","ProjectDIR/rt/spider/mf3/init-modules",},systemBaseMPATH="ProjectDIR/rt/spider/mf3/system:ProjectDIR/rt/spider/mf3/init-modules",}';
export _ModuleTable_;
===========================
step 74
step 75
lua ProjectDIR/src/lmod.in.lua shell --regression_testing spider Appl1
===========================
MODULEPATH=ProjectDIR/rt/spider/mf3/system:ProjectDIR/rt/spider/mf3/init-modules;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/spider/mf3/system","ProjectDIR/rt/spider/mf3/init-modules",},systemBaseMPATH="ProjectDIR/rt/spider/mf3/system:ProjectDIR/rt/spider/mf3/init-modules",}';
export _ModuleTable_;
===========================
step 75
step 76
lua ProjectDIR/src/lmod.in.lua shell --regression_testing spider Appl1
===========================
MODULEPATH=ProjectDIR/rt/spider/mf3/system:ProjectDIR/rt/spider/mf3/init-modules;
export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/spider/mf3/system","ProjectDIR/rt/spider/mf3/init-modules",},systemBaseMPATH="ProjectDIR/rt/spider/mf3/system:ProjectDIR/rt/spider/mf3/init-modules",}';
export _ModuleTable_;
===========================
step 76
step 77
lua ProjectDIR/src/lmod.in.lua shell --regression_testing avail
===========================
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/spider/mf4/Core:1;
Expand All @@ -1581,7 +1591,7 @@ export MODULEPATH;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/spider/mf4/Core",},systemBaseMPATH="ProjectDIR/rt/spider/mf4/Core",}';
export _ModuleTable_;
===========================
step 77
step 78
lua ProjectDIR/src/lmod.in.lua shell --regression_testing avail
===========================
__LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/spider/mf5/Core:1;
Expand Down
19 changes: 14 additions & 5 deletions rt/spider/spider.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ testdescript = {
runLmod spider #72
unsetMT
export MODULEPATH=$testDir/mf6/Core
rm -rf $HOME/.cache/lmod
mkdir $HOME/.cache/lmod
buildSpiderT $MODULEPATH > $HOME/.cache/lmod/spiderT.lua
runLmod spider #73
mv $HOME/.cache/lmod $HOME/.cache/.old_cache_73
# Case from U. of Antwerp where spider failed when adding a
# path of itself to $MODULEPATH
Expand All @@ -160,17 +169,17 @@ testdescript = {
unset LMOD_ADMIN_FILE
unset LMOD_PACKAGE_PATH
runLmod avail #73
runLmod avail #74
unset TRIGGER_BUG
runLmod spider Appl1 #74
export TRIGGER_BUG=
runLmod spider Appl1 #75
export TRIGGER_BUG=
runLmod spider Appl1 #76
unsetMT
export MODULEPATH=$testDir/mf4/Core
export EBVERSIONPYTHON="3.7"
runLmod avail #76
runLmod avail #77
# Case from Freie Universität Berlin where spider failed because
# dir added to MODULEPATH created a loopback -> Stack overflow
Expand All @@ -180,7 +189,7 @@ testdescript = {
unset LMOD_SHORT_TIME
export MODULEPATH_ROOT=$(testDir)/mf5
export MODULEPATH=$MODULEPATH_ROOT/Core
runLmod avail #77
runLmod avail #78
HOME=$ORIG_HOME
Expand Down
17 changes: 8 additions & 9 deletions src/modfuncs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,25 +242,24 @@ local function l_cleanupPathArgs(t)
local path = t[2]:trim()

if (s_cleanupDirT[name]) then
path = path:gsub(":+$",""):gsub("^:+","")
path = path:gsub(":+$",""):gsub("^:+",""):gsub(":+",":")
if (path == "") then path = false end
t[2] = path
end

return t
return
end


--------------------------------------------------------------------------
-- Prepend a value to a path like variable.
function prepend_path(...)
local t = l_convert2table(...)
dbg.start{"prepend_path(",l_concatTbl(t,", "),")"}
dbg.start{"prepend_path_rtm(",l_concatTbl(t,", "),")"}
if (not l_validateStringTable(2, "prepend_path",t)) then return end
l_cleanupPathArgs(t)



mcp:prepend_path(t)
l_cleanupPathArgs(t)
if (t[2]) then mcp:prepend_path(t) end
dbg.fini("prepend_path")
end

Expand All @@ -271,7 +270,7 @@ function append_path(...)
dbg.start{"append_path(",l_concatTbl(t,", "),")"}
if (not l_validateStringTable(2, "append_path",t)) then return end
l_cleanupPathArgs(t)
mcp:append_path(t)
if (t[2]) then mcp:append_path(t) end
dbg.fini("append_path")
end

Expand All @@ -282,7 +281,7 @@ function remove_path(...)
dbg.start{"remove_path(",l_concatTbl(t,", "),")"}
if (not l_validateStringTable(2, "remove_path",t)) then return end
l_cleanupPathArgs(t)
mcp:remove_path(t)
if (t[2]) then mcp:remove_path(t) end
dbg.fini("remove_path")
end

Expand Down

0 comments on commit 7114347

Please sign in to comment.