From afb2bccbd5fb3a6025e76de5045ae33e419a67c8 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Wed, 20 Jul 2022 13:12:26 -0500 Subject: [PATCH 01/16] Remove trailing spaces --- README.new | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.new b/README.new index 519ed6668..134ee9aa8 100644 --- a/README.new +++ b/README.new @@ -31,5 +31,3 @@ Lmod 8.7+ * Issue #593: In DirTree.lua l_versionFile(), Now only evaluate the highest priority entry in defaultA, instead of all. This avoids the issue where there is a .modulerc.lua which works and a .modulerc or .version file which has syntax errors. - - From c7f538347e78a25e1e2f2dd6a4c0661c1471c1c6 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 11:32:39 -0500 Subject: [PATCH 02/16] Correctly generate Version.lua file when installing from a tar ball. --- Makefile.in | 1 + README.new | 1 + 2 files changed, 2 insertions(+) diff --git a/Makefile.in b/Makefile.in index 6e5f847f1..8c6d30a2c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -578,6 +578,7 @@ gittag: echo ' local s = "@git@"' >> $(VERSION_SRC); \ echo ' if (s == "@" .. "git@") then s = "" end' >> $(VERSION_SRC); \ echo ' if (s == "("..M.tag()..")") then s = "" end' >> $(VERSION_SRC); \ + echo ' if (s == M.tag() ) then s = "" end' >> $(VERSION_SRC); \ echo ' return s' >> $(VERSION_SRC); \ echo 'end' >> $(VERSION_SRC); \ echo 'function M.date() return "$(VDATE)" end' >> $(VERSION_SRC); \ diff --git a/README.new b/README.new index 134ee9aa8..0a53c0287 100644 --- a/README.new +++ b/README.new @@ -31,3 +31,4 @@ Lmod 8.7+ * Issue #593: In DirTree.lua l_versionFile(), Now only evaluate the highest priority entry in defaultA, instead of all. This avoids the issue where there is a .modulerc.lua which works and a .modulerc or .version file which has syntax errors. + (8.7.9) * Correctly generate Version.lua file when installing from a tar ball. From 80455d181e9d1f7a01d5b1fe0067275da2d45e91 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 11:33:13 -0500 Subject: [PATCH 03/16] moving to TAG_VERSION 8.7.9 --- docs/source/conf.py | 3 ++- src/Version.lua | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index b699e3cb7..0d2b333b3 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -57,7 +57,7 @@ # The short X.Y version. version = '8.7' # The full version, including alpha/beta/rc tags. -release = '8.7.8' +release = '8.7.9' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -345,5 +345,6 @@ + diff --git a/src/Version.lua b/src/Version.lua index aaa7a1928..c54032943 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -1,12 +1,13 @@ local M={} -function M.tag() return "8.7.8" end +function M.tag() return "8.7.9" end function M.git() local s = "@git@" if (s == "@" .. "git@") then s = "" end if (s == "("..M.tag()..")") then s = "" end + if (s == M.tag() ) then s = "" end return s end -function M.date() return "2022-07-20 07:58 -05:00" end +function M.date() return "2022-07-25 11:33 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() From 80c7b94882cdaed607245602269c22c1ba3db07e Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 11:41:34 -0500 Subject: [PATCH 04/16] Update DirTree_spec.lua to handle Issue #593 --- spec/DirTree/DirTree_spec.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/DirTree/DirTree_spec.lua b/spec/DirTree/DirTree_spec.lua index d68a31036..77efd6b1c 100644 --- a/spec/DirTree/DirTree_spec.lua +++ b/spec/DirTree/DirTree_spec.lua @@ -45,7 +45,7 @@ describe("Testing DirTree Class: #DirTree.", ["fn"] = "%ProjDir%/spec/DirTree/mf/bio/bowtie/.version", ["fullName"] = "bio/bowtie/.version", ["mpath"] = "%ProjDir%/spec/DirTree/mf", - ["value"] = "64", + ["value"] = false, }, }, defaultT = { From d5c6b3625ee0f6d6f268ee6df9ae8c2913fe782f Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 11:41:45 -0500 Subject: [PATCH 05/16] moving to TAG_VERSION 8.7.9 --- docs/source/conf.py | 1 + src/Version.lua | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 0d2b333b3..77211a901 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -346,5 +346,6 @@ + diff --git a/src/Version.lua b/src/Version.lua index c54032943..4bdf89c6d 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -7,7 +7,7 @@ function M.git() if (s == M.tag() ) then s = "" end return s end -function M.date() return "2022-07-25 11:33 -05:00" end +function M.date() return "2022-07-25 11:41 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() From 877402481c3311e98a77321e5852b3737136fbc5 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 11:47:54 -0500 Subject: [PATCH 06/16] Checking Version.lua when not on a tag --- README.new | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.new b/README.new index 0a53c0287..c5f6db4c4 100644 --- a/README.new +++ b/README.new @@ -32,3 +32,5 @@ Lmod 8.7+ entry in defaultA, instead of all. This avoids the issue where there is a .modulerc.lua which works and a .modulerc or .version file which has syntax errors. (8.7.9) * Correctly generate Version.lua file when installing from a tar ball. + + From 73f7b113d747b84136b571bf7fe874be02879b39 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 11:53:18 -0500 Subject: [PATCH 07/16] Checking Version.lua when not on a tag again --- Makefile.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index 8c6d30a2c..decb84c4b 100644 --- a/Makefile.in +++ b/Makefile.in @@ -576,10 +576,9 @@ gittag: echo 'function M.tag() return "$(TAG)" end' >> $(VERSION_SRC); \ echo 'function M.git()' >> $(VERSION_SRC); \ echo ' local s = "@git@"' >> $(VERSION_SRC); \ - echo ' if (s == "@" .. "git@") then s = "" end' >> $(VERSION_SRC); \ - echo ' if (s == "("..M.tag()..")") then s = "" end' >> $(VERSION_SRC); \ - echo ' if (s == M.tag() ) then s = "" end' >> $(VERSION_SRC); \ - echo ' return s' >> $(VERSION_SRC); \ + echo ' if (s == "@" .. "git@") then s = "" end' >> $(VERSION_SRC); \ + echo ' if (s == M.tag() ) then s = "" end' >> $(VERSION_SRC); \ + echo ' return "("..s..")"' >> $(VERSION_SRC); \ echo 'end' >> $(VERSION_SRC); \ echo 'function M.date() return "$(VDATE)" end' >> $(VERSION_SRC); \ echo 'function M.name()' >> $(VERSION_SRC); \ From b5facaf3ce3a71e9f7c775b37afd58b03fe76ab9 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 11:56:01 -0500 Subject: [PATCH 08/16] moving to TAG_VERSION 8.7.9 --- docs/source/conf.py | 1 + src/Version.lua | 9 ++++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 77211a901..cf6fd9e77 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -347,5 +347,6 @@ + diff --git a/src/Version.lua b/src/Version.lua index 4bdf89c6d..faaa1d8bb 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -2,12 +2,11 @@ local M={} function M.tag() return "8.7.9" end function M.git() local s = "@git@" - if (s == "@" .. "git@") then s = "" end - if (s == "("..M.tag()..")") then s = "" end - if (s == M.tag() ) then s = "" end - return s + if (s == "@" .. "git@") then s = "" end + if (s == M.tag() ) then s = "" end + return "("..s..")" end -function M.date() return "2022-07-25 11:41 -05:00" end +function M.date() return "2022-07-25 11:56 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() From c7686bd9c422a6ed94e0654972d74150bb5764be Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 12:30:04 -0500 Subject: [PATCH 09/16] Correctly setting settarg version as well --- Makefile.in | 11 ++++++++--- src/Version.lua | 2 +- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Makefile.in b/Makefile.in index decb84c4b..0a82e451c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -81,6 +81,7 @@ PATH_TO_TCLSH := @PATH_TO_TCLSH@ PATH_TO_LS := @PATH_TO_LS@ MODULEPATH_ROOT := @MODULEPATH_ROOT@ VERSION_SRC := $(srcdir)/src/Version.lua +SETTARG_VSRC := $(srcdir)/settarg/Version.lua LUA_INCLUDE := @LUA_INCLUDE@ UPDATE_SYSTEM_FN := @UPDATE_SYSTEM_FN@ GIT_PROG := @PATH_TO_GIT@ @@ -250,7 +251,7 @@ __installMe: -e 's|@use_dot_files@|$(USE_DOT_FILES)|g' \ -e 's|@lang@|$(LMOD_OVERRIDE_LANG)|g' \ -e 's|@site_msg_file@|$(SITE_MSG_FILE)|g' \ - -e 's|@git@|($(GIT_VERSION))|g' \ + -e 's|@git@|$(GIT_VERSION)|g' \ -e 's|--@ignore_dirs@--|$(IGNORE_DIRS)|g' \ -e 's|@sys_lua_path@|$(SYS_LUA_PATH)|g' \ -e 's|@hidden_italic@|$(LMOD_HIDDEN_ITALIC)|g' \ @@ -572,13 +573,14 @@ gittag: echo "configure is out of date => try again"; \ else \ $(RM) $(VERSION_SRC); \ + $(RM) $(SETTARG_VSRC); \ echo 'local M={}' > $(VERSION_SRC); \ echo 'function M.tag() return "$(TAG)" end' >> $(VERSION_SRC); \ echo 'function M.git()' >> $(VERSION_SRC); \ echo ' local s = "@git@"' >> $(VERSION_SRC); \ echo ' if (s == "@" .. "git@") then s = "" end' >> $(VERSION_SRC); \ echo ' if (s == M.tag() ) then s = "" end' >> $(VERSION_SRC); \ - echo ' return "("..s..")"' >> $(VERSION_SRC); \ + echo ' return (s == "" and s or "("..s..")"' >> $(VERSION_SRC); \ echo 'end' >> $(VERSION_SRC); \ echo 'function M.date() return "$(VDATE)" end' >> $(VERSION_SRC); \ echo 'function M.name()' >> $(VERSION_SRC); \ @@ -589,8 +591,11 @@ gittag: echo ' return table.concat(a," ")' >> $(VERSION_SRC); \ echo 'end' >> $(VERSION_SRC); \ echo 'return M' >> $(VERSION_SRC); \ + cp $(VERSION_SRC) $(SETTARG_VSRC); \ $(UPDATE_VERSION) -p $(CONF_PY_PATTERN) --version $(TAG) $(CONF_PY); \ - git commit -m "moving to TAG_VERSION $(TAG)" $(CONF_PY) $(VERSION_SRC); \ + git commit -m "moving to TAG_VERSION $(TAG)" $(SETTARG_VSRC) \ + $(CONF_PY) \ + $(VERSION_SRC); \ git tag -a $(TAG) -m 'Setting TAG_VERSION to $(TAG)' ; \ branchName=`git status | head -n 1 | sed 's/^[# ]*On branch //g'` ; \ git push origin $$branchName ; \ diff --git a/src/Version.lua b/src/Version.lua index faaa1d8bb..41b0450d8 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -4,7 +4,7 @@ function M.git() local s = "@git@" if (s == "@" .. "git@") then s = "" end if (s == M.tag() ) then s = "" end - return "("..s..")" + return s == "" and "" or "("..s..")" end function M.date() return "2022-07-25 11:56 -05:00" end function M.name() From 9da79040156007d38f162981be6a5b128a9f0728 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 12:30:24 -0500 Subject: [PATCH 10/16] moving to TAG_VERSION 8.7.9 --- docs/source/conf.py | 1 + settarg/Version.lua | 11 +++++------ src/Version.lua | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index cf6fd9e77..2af86cc44 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -348,5 +348,6 @@ + diff --git a/settarg/Version.lua b/settarg/Version.lua index cb5a84f0b..4ec49bbdb 100644 --- a/settarg/Version.lua +++ b/settarg/Version.lua @@ -1,13 +1,12 @@ ---module('Version') local M={} -function M.tag() return "6.6" end +function M.tag() return "8.7.9" end function M.git() local s = "@git@" - if (s == "@" .. "git@") then s = "" end - if (s == "("..M.tag()..")") then s = "" end - return s + if (s == "@" .. "git@") then s = "" end + if (s == M.tag() ) then s = "" end + return (s == "" and s or "("..s..")" end -function M.date() return "2016-10-13 13:28 -05:00" end +function M.date() return "2022-07-25 12:30 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() diff --git a/src/Version.lua b/src/Version.lua index 41b0450d8..4ec49bbdb 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -4,9 +4,9 @@ function M.git() local s = "@git@" if (s == "@" .. "git@") then s = "" end if (s == M.tag() ) then s = "" end - return s == "" and "" or "("..s..")" + return (s == "" and s or "("..s..")" end -function M.date() return "2022-07-25 11:56 -05:00" end +function M.date() return "2022-07-25 12:30 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() From 020f3e37ba585afd2537e2034c8c9ed664967ae2 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 12:38:59 -0500 Subject: [PATCH 11/16] Correctly setting settarg version as well --- Makefile.in | 2 +- build.rtm | 12 ++++++++++++ src/Version.lua | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Makefile.in b/Makefile.in index 0a82e451c..2cfe796b0 100644 --- a/Makefile.in +++ b/Makefile.in @@ -580,7 +580,7 @@ gittag: echo ' local s = "@git@"' >> $(VERSION_SRC); \ echo ' if (s == "@" .. "git@") then s = "" end' >> $(VERSION_SRC); \ echo ' if (s == M.tag() ) then s = "" end' >> $(VERSION_SRC); \ - echo ' return (s == "" and s or "("..s..")"' >> $(VERSION_SRC); \ + echo ' return s == "" and s or "("..s..")"' >> $(VERSION_SRC); \ echo 'end' >> $(VERSION_SRC); \ echo 'function M.date() return "$(VDATE)" end' >> $(VERSION_SRC); \ echo 'function M.name()' >> $(VERSION_SRC); \ diff --git a/build.rtm b/build.rtm index cb3583490..15bc1cbbc 100755 --- a/build.rtm +++ b/build.rtm @@ -6,29 +6,41 @@ echo Making Version: $PKG_VERSION parallel_make_install() { if [ -d .git ]; then + echo p1 GIT_VERSION=`git describe --always` else + echo p2 GIT_VERSION=$(LUA_PATH="./src/?.lua;" lua -e "V=require('Version'); print(V.tag())") fi + echo p3 if [ "$BUILD_TYPE" != "EXPERIMENTAL" ]; then + echo p4 $SUDO $MAKE GIT_VERSION=$GIT_VERSION -j install $MAKE_EXTRA else + echo p5 echo "$SUDO $MAKE pre-install $MAKE_EXTRA" $SUDO $MAKE GIT_VERSION=$GIT_VERSION -j pre-install $MAKE_EXTRA $SUDO rm -f $BASE_DIR/lmod/EXPERIMENTAL $SUDO ln -s $PKG_VERSION $BASE_DIR/lmod/EXPERIMENTAL fi + echo p6 } save_old_version() { if [ "$SITE_CONTROLLED_PREFIX" != "yes" ]; then + echo 1 $SUDO rm -rf $BASE_DIR/$pkgName/orig + echo 2 if [ -d $BASE_DIR/$pkgName/$PKG_VERSION ]; then + echo 3 $SUDO cp -r $BASE_DIR/$pkgName/$PKG_VERSION $BASE_DIR/$pkgName/orig + echo 4 $SUDO rm -f $PKG/../$pkgName + echo 5 $SUDO ln -s orig $PKG/../$pkgName + echo 6 fi fi } diff --git a/src/Version.lua b/src/Version.lua index 4ec49bbdb..1cf962ce0 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -4,7 +4,7 @@ function M.git() local s = "@git@" if (s == "@" .. "git@") then s = "" end if (s == M.tag() ) then s = "" end - return (s == "" and s or "("..s..")" + return s == "" and s or "("..s..")" end function M.date() return "2022-07-25 12:30 -05:00" end function M.name() From 0dc9eb28fd3c1b19421a93872555cec72936cb50 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 12:40:08 -0500 Subject: [PATCH 12/16] removing debugging echo stmts --- build.rtm | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/build.rtm b/build.rtm index 15bc1cbbc..cb3583490 100755 --- a/build.rtm +++ b/build.rtm @@ -6,41 +6,29 @@ echo Making Version: $PKG_VERSION parallel_make_install() { if [ -d .git ]; then - echo p1 GIT_VERSION=`git describe --always` else - echo p2 GIT_VERSION=$(LUA_PATH="./src/?.lua;" lua -e "V=require('Version'); print(V.tag())") fi - echo p3 if [ "$BUILD_TYPE" != "EXPERIMENTAL" ]; then - echo p4 $SUDO $MAKE GIT_VERSION=$GIT_VERSION -j install $MAKE_EXTRA else - echo p5 echo "$SUDO $MAKE pre-install $MAKE_EXTRA" $SUDO $MAKE GIT_VERSION=$GIT_VERSION -j pre-install $MAKE_EXTRA $SUDO rm -f $BASE_DIR/lmod/EXPERIMENTAL $SUDO ln -s $PKG_VERSION $BASE_DIR/lmod/EXPERIMENTAL fi - echo p6 } save_old_version() { if [ "$SITE_CONTROLLED_PREFIX" != "yes" ]; then - echo 1 $SUDO rm -rf $BASE_DIR/$pkgName/orig - echo 2 if [ -d $BASE_DIR/$pkgName/$PKG_VERSION ]; then - echo 3 $SUDO cp -r $BASE_DIR/$pkgName/$PKG_VERSION $BASE_DIR/$pkgName/orig - echo 4 $SUDO rm -f $PKG/../$pkgName - echo 5 $SUDO ln -s orig $PKG/../$pkgName - echo 6 fi fi } From 287aaa83a4c66d5a3a958cf7930a164d70215563 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 12:45:07 -0500 Subject: [PATCH 13/16] moving to TAG_VERSION 8.7.9 --- docs/source/conf.py | 1 + settarg/Version.lua | 4 ++-- src/Version.lua | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 2af86cc44..6bc808f77 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -349,5 +349,6 @@ + diff --git a/settarg/Version.lua b/settarg/Version.lua index 4ec49bbdb..377becd9f 100644 --- a/settarg/Version.lua +++ b/settarg/Version.lua @@ -4,9 +4,9 @@ function M.git() local s = "@git@" if (s == "@" .. "git@") then s = "" end if (s == M.tag() ) then s = "" end - return (s == "" and s or "("..s..")" + return s == "" and s or "("..s..")" end -function M.date() return "2022-07-25 12:30 -05:00" end +function M.date() return "2022-07-25 12:45 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() diff --git a/src/Version.lua b/src/Version.lua index 1cf962ce0..377becd9f 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -6,7 +6,7 @@ function M.git() if (s == M.tag() ) then s = "" end return s == "" and s or "("..s..")" end -function M.date() return "2022-07-25 12:30 -05:00" end +function M.date() return "2022-07-25 12:45 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() From 12ddc1070687edb0e12d358b4ccda762bccc7bfa Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Mon, 25 Jul 2022 12:46:30 -0500 Subject: [PATCH 14/16] moving to TAG_VERSION 8.7.9 --- docs/source/conf.py | 1 + settarg/Version.lua | 2 +- src/Version.lua | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 6bc808f77..d9109e4d7 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -350,5 +350,6 @@ + diff --git a/settarg/Version.lua b/settarg/Version.lua index 377becd9f..e02b1c7ee 100644 --- a/settarg/Version.lua +++ b/settarg/Version.lua @@ -6,7 +6,7 @@ function M.git() if (s == M.tag() ) then s = "" end return s == "" and s or "("..s..")" end -function M.date() return "2022-07-25 12:45 -05:00" end +function M.date() return "2022-07-25 12:46 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() diff --git a/src/Version.lua b/src/Version.lua index 377becd9f..e02b1c7ee 100644 --- a/src/Version.lua +++ b/src/Version.lua @@ -6,7 +6,7 @@ function M.git() if (s == M.tag() ) then s = "" end return s == "" and s or "("..s..")" end -function M.date() return "2022-07-25 12:45 -05:00" end +function M.date() return "2022-07-25 12:46 -05:00" end function M.name() local a = {} a[#a+1] = M.tag() From 0a04c946e0f868846d7fef79f9c115dcc309c600 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Fri, 29 Jul 2022 11:05:47 -0500 Subject: [PATCH 15/16] handling OpenFOAM script error attempt --- messageDir/en.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/messageDir/en.lua b/messageDir/en.lua index 0cfa0f9ed..9178c86b7 100644 --- a/messageDir/en.lua +++ b/messageDir/en.lua @@ -175,7 +175,10 @@ Alternatively, you can set the environment variable LMOD_DISABLE_SAME_NAME_AUTOS $ module spider %{sn} for available versions.]==], - e_Sh_Error = "Error in script \"%{script}\": %{errorMsg}", + e_Sh_Error = [==[Error found in sourcing script "%{script}": %{errorMsg} +If this is a bash script please try: + $ set -e; . %{script} +]==], e_Sh_convertSh2MF = "convertSh2MF script failed to produce 7 blocks\n", e_Spdr_Timeout = "Spider search timed out.\n", e_Swap_Failed = "Swap failed: \"%{name}\" is not loaded.\n", From f4c1a3a23f73e7fe9fc6d8512a0be6d4199ca452 Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Fri, 29 Jul 2022 11:57:33 -0500 Subject: [PATCH 16/16] Better message when sourcing shell scripts --- docs/source/260_sh_to_modulefile.rst | 28 +++++++++++++ messageDir/en.lua | 3 +- rt/sh_to_modulefile/err.txt | 46 ++++++++++++++-------- rt/sh_to_modulefile/out.txt | 30 ++++++++------ rt/sh_to_modulefile/sh_to_modulefile.tdesc | 25 ++++++------ rt/sh_to_modulefile/unalias.sh | 3 ++ 6 files changed, 93 insertions(+), 42 deletions(-) create mode 100644 rt/sh_to_modulefile/unalias.sh diff --git a/docs/source/260_sh_to_modulefile.rst b/docs/source/260_sh_to_modulefile.rst index b5e465e59..c86775276 100644 --- a/docs/source/260_sh_to_modulefile.rst +++ b/docs/source/260_sh_to_modulefile.rst @@ -109,6 +109,34 @@ Lmod assumes that these scripts **DO NOT** have module commands or change $MODULEPATH. +Shell script are evaluated with set -e +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +Shell scripts are evaluated by sh_to_modulefile and the source_sh() +function with set -e in bash or equivalently in +other shells. This means that execution of the shell script stops at +the first time a statement in the script has a non-zero status. +Turning this option on means that Lmod can know that the evaluation of +the shell script has an issue. But this also means that sometimes a +script would work fine without using "set -e". + +Assuming the script is a bash script, please do the following:: + + $ set -exv ; . ./my_script + +This should tell you where the issue was found. Note that the error +may be in another script sourced by "my_script". In particular, you +might have a silent error. For example, a bash script might have a +line:: + + unalias some_alias_name 2> /dev/null + +where "some_alias_name" is not currently an alias. This unalias statement +returns a non-zero status but is silent because of the redirection of +stderr to /dev/null. One fix might be:: + + unalias some_alias_name 2> /dev/null || true + Calling the shell script directly inside a modulefile ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/messageDir/en.lua b/messageDir/en.lua index 9178c86b7..e8fe6d0b0 100644 --- a/messageDir/en.lua +++ b/messageDir/en.lua @@ -177,7 +177,8 @@ Alternatively, you can set the environment variable LMOD_DISABLE_SAME_NAME_AUTOS for available versions.]==], e_Sh_Error = [==[Error found in sourcing script "%{script}": %{errorMsg} If this is a bash script please try: - $ set -e; . %{script} + $ set -exv; . %{script} +See https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html for details. ]==], e_Sh_convertSh2MF = "convertSh2MF script failed to produce 7 blocks\n", e_Spdr_Timeout = "Spider search timed out.\n", diff --git a/rt/sh_to_modulefile/err.txt b/rt/sh_to_modulefile/err.txt index a06a46d5d..2f00b0a1b 100644 --- a/rt/sh_to_modulefile/err.txt +++ b/rt/sh_to_modulefile/err.txt @@ -2,7 +2,7 @@ step 1 lua ProjectDIR/src/lmod.in.lua bash --regression_testing --version =========================== -Modules based on Lua: Version 8.6.16 2022-03-22 14:19 -05:00 +Modules based on Lua: Version 8.7.9 2022-07-25 12:46 -05:00 by Robert McLay mclay@tacc.utexas.edu =========================== step 2 @@ -24,10 +24,21 @@ buildSh2MF --from csh ProjectDIR/rt/sh_to_modulefile/cshScript.csh step 6 buildSh2MF ProjectDIR/rt/sh_to_modulefile/broken.sh =========================== -Error in script "ProjectDIR/rt/sh_to_modulefile/broken.sh": +Error found in sourcing script "ProjectDIR/rt/sh_to_modulefile/broken.sh": ProjectDIR/rt/sh_to_modulefile/broken.sh: line 3: fooBar: command not found +If this is a bash script please try: + $ set -exv; . ProjectDIR/rt/sh_to_modulefile/broken.sh +See https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html for details. =========================== step 7 +buildSh2MF ProjectDIR/rt/sh_to_modulefile/unalias.sh +=========================== +Error found in sourcing script "ProjectDIR/rt/sh_to_modulefile/unalias.sh": +If this is a bash script please try: + $ set -exv; . ProjectDIR/rt/sh_to_modulefile/unalias.sh +See https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html for details. +=========================== +step 8 lua ProjectDIR/src/lmod.in.lua bash --regression_testing show wrapperSh/1.0 =========================== ProjectDIR/rt/sh_to_modulefile/mf/wrapperSh/1.0.lua: @@ -66,11 +77,11 @@ setenv("MY_NAME","unknown") source_sh("bash","ProjectDIR/rt/sh_to_modulefile/second.sh arg1") setenv("SECOND","FOO_BAR") =========================== -step 8 +step 9 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load wrapperSh/1.0 =========================== =========================== -step 9 +step 10 lua ProjectDIR/src/lmod.in.lua bash --regression_testing show wrapperSh/1.0 =========================== ProjectDIR/rt/sh_to_modulefile/mf/wrapperSh/1.0.lua: @@ -109,17 +120,17 @@ setenv("MY_NAME","tstScript.sh") source_sh("bash","ProjectDIR/rt/sh_to_modulefile/second.sh arg1") setenv("SECOND","FOO_BAR") =========================== -step 10 +step 11 lua ProjectDIR/src/lmod.in.lua bash --regression_testing refresh =========================== =========================== -step 11 +step 12 lua ProjectDIR/src/lmod.in.lua bash --regression_testing list =========================== Currently Loaded Modules: 1) wrapperSh/1.0 =========================== -step 12 +step 13 lua ProjectDIR/src/lmod.in.lua bash --regression_testing --mt =========================== _ModuleTable_ = { @@ -173,34 +184,37 @@ _ModuleTable_ = { systemBaseMPATH = "ProjectDIR/rt/sh_to_modulefile/mf", } =========================== -step 13 +step 14 lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload wrapperSh/1.0 =========================== =========================== -step 14 +step 15 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load brokenSh/1.0 =========================== -Lmod has detected the following error: Error in script "ProjectDIR/rt/sh_to_modulefile/broken.sh": +Lmod has detected the following error: Error found in sourcing script "ProjectDIR/rt/sh_to_modulefile/broken.sh": ProjectDIR/rt/sh_to_modulefile/broken.sh: line 3: fooBar: command not found +If this is a bash script please try: + $ set -exv; . ProjectDIR/rt/sh_to_modulefile/broken.sh +See https://lmod.readthedocs.io/en/latest/260_sh_to_modulefile.html for details. While processing the following module(s): Module fullname Module Filename brokenSh/1.0 ProjectDIR/rt/sh_to_modulefile/mf/brokenSh/1.0.lua =========================== -step 15 +step 16 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load wrapperSh/1.0 =========================== =========================== -step 16 +step 17 lua ProjectDIR/src/lmod.in.lua bash --regression_testing save =========================== Saved current collection of modules to: "default" =========================== -step 17 +step 18 lua ProjectDIR/src/lmod.in.lua bash --regression_testing restore =========================== Restoring modules from user's default =========================== -step 18 +step 19 lua ProjectDIR/src/lmod.in.lua bash --regression_testing --mt =========================== _ModuleTable_ = { @@ -254,11 +268,11 @@ _ModuleTable_ = { systemBaseMPATH = "ProjectDIR/rt/sh_to_modulefile/mf", } =========================== -step 19 +step 20 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load A =========================== =========================== -step 20 +step 21 lua ProjectDIR/src/lmod.in.lua bash --regression_testing list =========================== Currently Loaded Modules: diff --git a/rt/sh_to_modulefile/out.txt b/rt/sh_to_modulefile/out.txt index 7b30513dd..a8a5e49db 100644 --- a/rt/sh_to_modulefile/out.txt +++ b/rt/sh_to_modulefile/out.txt @@ -103,6 +103,10 @@ buildSh2MF ProjectDIR/rt/sh_to_modulefile/broken.sh =========================== =========================== step 7 +buildSh2MF ProjectDIR/rt/sh_to_modulefile/unalias.sh +=========================== +=========================== +step 8 lua ProjectDIR/src/lmod.in.lua bash --regression_testing show wrapperSh/1.0 =========================== __LMOD_REF_COUNT_MODULEPATH=ProjectDIR/rt/sh_to_modulefile/mf:1; @@ -112,7 +116,7 @@ export MODULEPATH; _ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={},mpathA={"ProjectDIR/rt/sh_to_modulefile/mf",},systemBaseMPATH="ProjectDIR/rt/sh_to_modulefile/mf",}'; export _ModuleTable_; =========================== -step 8 +step 9 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load wrapperSh/1.0 =========================== LOADEDMODULES=wrapperSh/1.0; @@ -160,7 +164,7 @@ save_args () { }; [[ -n "${BASH_VERSION:-}" ]] && complete -F _xyz123 xyz123; =========================== -step 9 +step 10 lua ProjectDIR/src/lmod.in.lua bash --regression_testing show wrapperSh/1.0 =========================== MODULEPATH=ProjectDIR/rt/sh_to_modulefile/mf; @@ -168,7 +172,7 @@ export MODULEPATH; _ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={wrapperSh={fn="ProjectDIR/rt/sh_to_modulefile/mf/wrapperSh/1.0.lua",fullName="wrapperSh/1.0",loadOrder=1,mcmdT={["ProjectDIR/rt/sh_to_modulefile/second.sh arg1"]={"setenv(\"SECOND\",\"FOO_BAR\")",},["ProjectDIR/rt/sh_to_modulefile/tstScript.sh"]={"setenv(\"MY_NAME\",\"tstScript.sh\")","prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")","append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")","setenv(\"TST_SCRIPT\",\"1\")","set_alias(\"fooAlias\",\"foobin -q -l\")",[[set_shell_function("banner"," \\ local str=\\"$1\\";\\ local RED='\\033[1;31m';\\ local NONE='\\033[0m';\\ echo \\"${RED}${str}${NONE}\\"\\","")]],[[set_shell_function("fooFunc"," \\ echo \\"arg1: $1\\"\\","")]],[[set_shell_function("junk"," \\ if [ -n \\"${ZSH_VERSION:-}\\" ]; then\\ \\\\echo \\"junk\\";\\ fi\\","")]],[[set_shell_function("my_help"," \\ echo \\"do not forget \\\\\\"foo\\\\\\"\\"\\","")]],[[set_shell_function("save_args"," \\ for arg in \\"$@\\";\\ do\\ printf \\"%s\\\\n\\" \\"$arg\\" | sed -e \\"s/'/'\\\\\\\\\\\\\\\\''/g\\" -e \\"1s/^/'/\\" -e \\"\\\\$s/\\\\$/' \\\\\\\\\\\\\\\\/\\";\\ done;\\ echo \\" \\"\\","")]],"complete(\"bash\",\"XyZ123\",\"-F _xyz123\")",},},propT={},stackDepth=0,status="active",userName="wrapperSh/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/sh_to_modulefile/mf",},systemBaseMPATH="ProjectDIR/rt/sh_to_modulefile/mf",}'; export _ModuleTable_; =========================== -step 10 +step 11 lua ProjectDIR/src/lmod.in.lua bash --regression_testing refresh =========================== MODULEPATH=ProjectDIR/rt/sh_to_modulefile/mf; @@ -202,7 +206,7 @@ save_args () { }; [[ -n "${BASH_VERSION:-}" ]] && complete -F _xyz123 xyz123; =========================== -step 11 +step 12 lua ProjectDIR/src/lmod.in.lua bash --regression_testing list =========================== MODULEPATH=ProjectDIR/rt/sh_to_modulefile/mf; @@ -210,11 +214,11 @@ export MODULEPATH; _ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={wrapperSh={fn="ProjectDIR/rt/sh_to_modulefile/mf/wrapperSh/1.0.lua",fullName="wrapperSh/1.0",loadOrder=1,mcmdT={["ProjectDIR/rt/sh_to_modulefile/second.sh arg1"]={"setenv(\"SECOND\",\"FOO_BAR\")",},["ProjectDIR/rt/sh_to_modulefile/tstScript.sh"]={"setenv(\"MY_NAME\",\"tstScript.sh\")","prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")","append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")","setenv(\"TST_SCRIPT\",\"1\")","set_alias(\"fooAlias\",\"foobin -q -l\")",[[set_shell_function("banner"," \\ local str=\\"$1\\";\\ local RED='\\033[1;31m';\\ local NONE='\\033[0m';\\ echo \\"${RED}${str}${NONE}\\"\\","")]],[[set_shell_function("fooFunc"," \\ echo \\"arg1: $1\\"\\","")]],[[set_shell_function("junk"," \\ if [ -n \\"${ZSH_VERSION:-}\\" ]; then\\ \\\\echo \\"junk\\";\\ fi\\","")]],[[set_shell_function("my_help"," \\ echo \\"do not forget \\\\\\"foo\\\\\\"\\"\\","")]],[[set_shell_function("save_args"," \\ for arg in \\"$@\\";\\ do\\ printf \\"%s\\\\n\\" \\"$arg\\" | sed -e \\"s/'/'\\\\\\\\\\\\\\\\''/g\\" -e \\"1s/^/'/\\" -e \\"\\\\$s/\\\\$/' \\\\\\\\\\\\\\\\/\\";\\ done;\\ echo \\" \\"\\","")]],"complete(\"bash\",\"XyZ123\",\"-F _xyz123\")",},},propT={},stackDepth=0,status="active",userName="wrapperSh/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/sh_to_modulefile/mf",},systemBaseMPATH="ProjectDIR/rt/sh_to_modulefile/mf",}'; export _ModuleTable_; =========================== -step 12 +step 13 lua ProjectDIR/src/lmod.in.lua bash --regression_testing --mt =========================== =========================== -step 13 +step 14 lua ProjectDIR/src/lmod.in.lua bash --regression_testing unload wrapperSh/1.0 =========================== unset LOADEDMODULES; @@ -238,12 +242,12 @@ unset -f my_help 2> /dev/null || true; unset -f save_args 2> /dev/null || true; [[ -n "${BASH_VERSION:-}" ]] && complete -r xyz123; =========================== -step 14 +step 15 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load brokenSh/1.0 =========================== false =========================== -step 15 +step 16 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load wrapperSh/1.0 =========================== LOADEDMODULES=wrapperSh/1.0; @@ -291,7 +295,7 @@ save_args () { }; [[ -n "${BASH_VERSION:-}" ]] && complete -F _xyz123 xyz123; =========================== -step 16 +step 17 lua ProjectDIR/src/lmod.in.lua bash --regression_testing save =========================== MODULEPATH=ProjectDIR/rt/sh_to_modulefile/mf; @@ -299,7 +303,7 @@ export MODULEPATH; _ModuleTable_='_ModuleTable_={MTversion=3,depthT={},family={},mT={wrapperSh={fn="ProjectDIR/rt/sh_to_modulefile/mf/wrapperSh/1.0.lua",fullName="wrapperSh/1.0",loadOrder=1,mcmdT={["ProjectDIR/rt/sh_to_modulefile/second.sh arg1"]={"setenv(\"SECOND\",\"FOO_BAR\")",},["ProjectDIR/rt/sh_to_modulefile/tstScript.sh"]={"setenv(\"MY_NAME\",\"tstScript.sh\")","prepend_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/bin\")","append_path(\"PATH\",\"ProjectDIR/rt/sh_to_modulefile/sbin\")","setenv(\"TST_SCRIPT\",\"1\")","set_alias(\"fooAlias\",\"foobin -q -l\")",[[set_shell_function("banner"," \\ local str=\\"$1\\";\\ local RED='\\033[1;31m';\\ local NONE='\\033[0m';\\ echo \\"${RED}${str}${NONE}\\"\\","")]],[[set_shell_function("fooFunc"," \\ echo \\"arg1: $1\\"\\","")]],[[set_shell_function("junk"," \\ if [ -n \\"${ZSH_VERSION:-}\\" ]; then\\ \\\\echo \\"junk\\";\\ fi\\","")]],[[set_shell_function("my_help"," \\ echo \\"do not forget \\\\\\"foo\\\\\\"\\"\\","")]],[[set_shell_function("save_args"," \\ for arg in \\"$@\\";\\ do\\ printf \\"%s\\\\n\\" \\"$arg\\" | sed -e \\"s/'/'\\\\\\\\\\\\\\\\''/g\\" -e \\"1s/^/'/\\" -e \\"\\\\$s/\\\\$/' \\\\\\\\\\\\\\\\/\\";\\ done;\\ echo \\" \\"\\","")]],"complete(\"bash\",\"XyZ123\",\"-F _xyz123\")",},},propT={},stackDepth=0,status="active",userName="wrapperSh/1.0",wV="000000001.*zfinal",},},mpathA={"ProjectDIR/rt/sh_to_modulefile/mf",},systemBaseMPATH="ProjectDIR/rt/sh_to_modulefile/mf",}'; export _ModuleTable_; =========================== -step 17 +step 18 lua ProjectDIR/src/lmod.in.lua bash --regression_testing restore =========================== MODULEPATH=ProjectDIR/rt/sh_to_modulefile/mf; @@ -343,11 +347,11 @@ save_args () { }; [[ -n "${BASH_VERSION:-}" ]] && complete -F _xyz123 xyz123; =========================== -step 18 +step 19 lua ProjectDIR/src/lmod.in.lua bash --regression_testing --mt =========================== =========================== -step 19 +step 20 lua ProjectDIR/src/lmod.in.lua bash --regression_testing load A =========================== LOADEDMODULES=A/1.0; @@ -391,7 +395,7 @@ save_args () { }; [[ -n "${BASH_VERSION:-}" ]] && complete -F _xyz123 xyz123; =========================== -step 20 +step 21 lua ProjectDIR/src/lmod.in.lua bash --regression_testing list =========================== MODULEPATH=OutputDIR/mf; diff --git a/rt/sh_to_modulefile/sh_to_modulefile.tdesc b/rt/sh_to_modulefile/sh_to_modulefile.tdesc index b68b0b860..3af32a631 100644 --- a/rt/sh_to_modulefile/sh_to_modulefile.tdesc +++ b/rt/sh_to_modulefile/sh_to_modulefile.tdesc @@ -29,18 +29,19 @@ testdescript = { runSh2MF $(testDir)/path_both_ends.sh # 4 runSh2MF --from csh $(testDir)/cshScript.csh # 5 runSh2MF $(testDir)/broken.sh # 6 - runLmod show wrapperSh/1.0 # 7 - runLmod load wrapperSh/1.0 # 8 - runLmod show wrapperSh/1.0 # 9 - runLmod refresh #10 - runLmod list #11 - runLmod --mt #12 - runLmod unload wrapperSh/1.0 #13 - runLmod load brokenSh/1.0 #14 - runLmod load wrapperSh/1.0 #15 - runLmod save #16 - runLmod restore #18 - runLmod --mt #19 + runSh2MF $(testDir)/unalias.sh # 7 + runLmod show wrapperSh/1.0 # 8 + runLmod load wrapperSh/1.0 # 9 + runLmod show wrapperSh/1.0 #10 + runLmod refresh #11 + runLmod list #12 + runLmod --mt #13 + runLmod unload wrapperSh/1.0 #14 + runLmod load brokenSh/1.0 #15 + runLmod load wrapperSh/1.0 #16 + runLmod save #18 + runLmod restore #19 + runLmod --mt #20 unsetMT diff --git a/rt/sh_to_modulefile/unalias.sh b/rt/sh_to_modulefile/unalias.sh new file mode 100644 index 000000000..5993b3707 --- /dev/null +++ b/rt/sh_to_modulefile/unalias.sh @@ -0,0 +1,3 @@ +#!/bin/bash +# -*- shell-script -*- +unalias foo_bar_baz 2> /dev/null