Skip to content

Commit

Permalink
Issue #710: path2pathA() keep double delims, Reduce triple delims to …
Browse files Browse the repository at this point in the history
…double
  • Loading branch information
Robert McLay committed Jul 8, 2024
1 parent 83bc8c4 commit b6dd349
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 6 deletions.
5 changes: 2 additions & 3 deletions README.new
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,5 @@ Lmod 8.7+
* ModuleTable modification: Changes to $MODULEPATH are stored in an entry.
(8.7.42) * Fix setting of $FPATH when running bash or ksh shell and executing zsh -l.
(8.7.43) * Support for ksh flag not needed anymore



W.I.P:
(8.7.44) * Issue #710: path2pathA() keep double delims, Reduce triple delims to double
10 changes: 9 additions & 1 deletion rt/manpath/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.20 2023-03-16 11:43 -05:00
Modules based on Lua: Version 8.7.43 2024-06-24 15:50 -06:00
by Robert McLay [email protected]
===========================
step 2
Expand All @@ -28,3 +28,11 @@ lua ProjectDIR/src/lmod.in.lua shell --regression_testing load unix
step 7
lua ProjectDIR/src/lmod.in.lua shell --regression_testing unload unix
===========================
===========================
step 8
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load abc
===========================
===========================
step 9
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load def
===========================
4 changes: 4 additions & 0 deletions rt/manpath/manpath.tdesc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ testdescript = {
export MANPATH=/unknown/apps/junk/share/man
runLmod load unix # 6
runLmod unload unix # 7
export MANPATH=/opt/X/man:::/opt/Y/man
runLmod load abc # 8
runLmod load def # 9
HOME=$ORIG_HOME
Expand Down
1 change: 1 addition & 0 deletions rt/manpath/mf/Core/abc/1.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
prepend_path("MANPATH","/opt/apps/abc/share/man")
1 change: 1 addition & 0 deletions rt/manpath/mf/Core/def/2.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
append_path("MANPATH","/opt/apps/def//share/man")
32 changes: 32 additions & 0 deletions rt/manpath/out.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,35 @@ export MODULEPATH;
unset _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/manpath/mf/Core",},systemBaseMPATH="ProjectDIR/rt/manpath/mf/Core",}';
export _ModuleTable_;
===========================
step 8
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load abc
===========================
LOADEDMODULES=abc/1.0;
export LOADEDMODULES;
__LMOD_REF_COUNT_MANPATH=/opt/apps/abc/share/man:1\;/opt/X/man:1\;:1\;/opt/Y/man:1;
export __LMOD_REF_COUNT_MANPATH;
MANPATH=/opt/apps/abc/share/man:/opt/X/man::/opt/Y/man;
export MANPATH;
MODULEPATH=ProjectDIR/rt/manpath/mf/Core;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/manpath/mf/Core/abc/1.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={abc={fn="ProjectDIR/rt/manpath/mf/Core/abc/1.0.lua",fullName="abc/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="abc",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/manpath/mf/Core",},systemBaseMPATH="ProjectDIR/rt/manpath/mf/Core",}';
export _ModuleTable_;
===========================
step 9
lua ProjectDIR/src/lmod.in.lua shell --regression_testing load def
===========================
LOADEDMODULES=abc/1.0:def/2.0;
export LOADEDMODULES;
__LMOD_REF_COUNT_MANPATH=/opt/apps/abc/share/man:1\;/opt/X/man:1\;:1\;/opt/Y/man:1\;/opt/apps/def/share/man:1;
export __LMOD_REF_COUNT_MANPATH;
MANPATH=/opt/apps/abc/share/man:/opt/X/man::/opt/Y/man:/opt/apps/def/share/man;
export MANPATH;
MODULEPATH=ProjectDIR/rt/manpath/mf/Core;
export MODULEPATH;
_LMFILES_=ProjectDIR/rt/manpath/mf/Core/abc/1.0.lua:ProjectDIR/rt/manpath/mf/Core/def/2.0.lua;
export _LMFILES_;
_ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={abc={fn="ProjectDIR/rt/manpath/mf/Core/abc/1.0.lua",fullName="abc/1.0",loadOrder=1,propT={},stackDepth=0,status="active",userName="abc",wV="000000001.*zfinal",},def={fn="ProjectDIR/rt/manpath/mf/Core/def/2.0.lua",fullName="def/2.0",loadOrder=2,propT={},stackDepth=0,status="active",userName="def",wV="000000002.*zfinal",},},mpathA={"ProjectDIR/rt/manpath/mf/Core",},systemBaseMPATH="ProjectDIR/rt/manpath/mf/Core",}';
export _ModuleTable_;
9 changes: 7 additions & 2 deletions src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -595,10 +595,15 @@ function path2pathA(path, delim, clearDoubleSlash)
if (path == '') then
return { '' }
end
local delimPatt = delim .. "+";

-- If path is /sw1/man::/sw2/man then
-- keep the double delim's
-- However convert /sw1/man:::/sw2/man to
-- /sw1/man::/sw2/man

path = path:gsub(delimPatt,delim)
local delimPatt = delim .. delim .. "+";
local delimStr = delim .. delim
path = path:gsub(delimPatt,delimStr)

local pathA = {}
for v in path:split(delim) do
Expand Down

0 comments on commit b6dd349

Please sign in to comment.