From b6dd34961c834907f06fd1fe8db754703f348c2c Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 8 Jul 2024 11:27:54 -0600 Subject: [PATCH] Issue #710: path2pathA() keep double delims, Reduce triple delims to double --- README.new | 5 ++--- rt/manpath/err.txt | 10 +++++++++- rt/manpath/manpath.tdesc | 4 ++++ rt/manpath/mf/Core/abc/1.0.lua | 1 + rt/manpath/mf/Core/def/2.0.lua | 1 + rt/manpath/out.txt | 32 ++++++++++++++++++++++++++++++++ src/utils.lua | 9 +++++++-- 7 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 rt/manpath/mf/Core/abc/1.0.lua create mode 100644 rt/manpath/mf/Core/def/2.0.lua diff --git a/README.new b/README.new index 8e7c26e55..dc32f4ea5 100644 --- a/README.new +++ b/README.new @@ -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 diff --git a/rt/manpath/err.txt b/rt/manpath/err.txt index 4e41475b3..80cbc60ce 100644 --- a/rt/manpath/err.txt +++ b/rt/manpath/err.txt @@ -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 mclay@tacc.utexas.edu =========================== step 2 @@ -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 +=========================== diff --git a/rt/manpath/manpath.tdesc b/rt/manpath/manpath.tdesc index a1e07cc87..1f4513e0a 100644 --- a/rt/manpath/manpath.tdesc +++ b/rt/manpath/manpath.tdesc @@ -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 diff --git a/rt/manpath/mf/Core/abc/1.0.lua b/rt/manpath/mf/Core/abc/1.0.lua new file mode 100644 index 000000000..8178f8790 --- /dev/null +++ b/rt/manpath/mf/Core/abc/1.0.lua @@ -0,0 +1 @@ +prepend_path("MANPATH","/opt/apps/abc/share/man") diff --git a/rt/manpath/mf/Core/def/2.0.lua b/rt/manpath/mf/Core/def/2.0.lua new file mode 100644 index 000000000..d1bebbbb2 --- /dev/null +++ b/rt/manpath/mf/Core/def/2.0.lua @@ -0,0 +1 @@ +append_path("MANPATH","/opt/apps/def//share/man") diff --git a/rt/manpath/out.txt b/rt/manpath/out.txt index 214bdca9b..130aebe58 100644 --- a/rt/manpath/out.txt +++ b/rt/manpath/out.txt @@ -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_; diff --git a/src/utils.lua b/src/utils.lua index b90dd903f..0c314ea97 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -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