From d7c62c31b4c08893148de3d49f1be2b0f474d0a4 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 23 Oct 2025 11:46:36 +0200 Subject: [PATCH 1/8] Fix issues for locale, lesspipe and LD_LIBRARY_PATH in EESSI module --- .github/workflows/tests_eessi_module.yml | 41 +++++++++++++++++++++++- init/modules/EESSI/2023.06.lua | 25 +++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index e27494ba..33b1cb19 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -115,7 +115,7 @@ jobs: # EESSI_DEBUG_INIT/EESSI_ARCHDETECT_OPTIONS only relevant for Lmod init unset EESSI_DEBUG_INIT # Store all relevant environment variables - env | grep -E '(^EESSI_|^LMOD_RC|^LMOD_PACKAGE_PATH|^MODULEPATH)' | grep -v EESSI_ARCHDETECT_OPTIONS | sort > "${moduleoutfile}" + env | grep -E '(^EESSI_|^LMOD_RC|^LMOD_PACKAGE_PATH|^MODULEPATH)' | grep -v EESSI_ARCHDETECT_OPTIONS | grep -v EESSI_DEFAULT_HOST_LD_LIBRARY_PATH | sort > "${moduleoutfile}" module unload EESSI/${{matrix.EESSI_VERSION}} # We should only have two EESSI_* variables defined (which set the overrides) @@ -315,3 +315,42 @@ jobs: module load "EESSI/${{matrix.EESSI_VERSION}}" GREP_PATTERN="Lmod is automatically replacing \"EESSI/${{matrix.EESSI_VERSION}}\" with \"${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}\"." module load "${LOCAL_STACK_NAME}/${LOCAL_STACK_VERSION}" |& grep "${GREP_PATTERN}" + + check_ld_library_path_eessi_module: + runs-on: ubuntu-24.04 + strategy: + fail-fast: false + matrix: + EESSI_VERSION: + - '2023.06' + - '2025.06' + + steps: + - name: Check out software-layer repository + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Mount EESSI CernVM-FS repository + uses: cvmfs-contrib/github-action-cvmfs@55899ca74cf78ab874bdf47f5a804e47c198743c # v4.0 + with: + cvmfs_config_package: https://github.com/EESSI/filesystem-layer/releases/download/latest/cvmfs-config-eessi_latest_all.deb + cvmfs_http_proxy: DIRECT + cvmfs_repositories: software.eessi.io + + - name: Make sure we are filtering LD_LIBRARY_PATH if necessary + run: | + # Initialise Lmod + . /cvmfs/software.eessi.io/versions/${{matrix.EESSI_VERSION}}/compat/linux/$(uname -m)/usr/share/Lmod/init/bash + + # Make sure we are using the EESSI module file from the repository + export MODULEPATH=init/modules + + # Create LD_LIBRARY_PATH to test with + export FAKE_PATH=/path/does/not/exist + export INITIAL_LD_LIBRARY_PATH="/usr/lib:$FAKE_PATH" + export LD_LIBRARY_PATH="$INITIAL_LD_LIBRARY_PATH" + module load "EESSI/${{matrix.EESSI_VERSION}}" + # Check we have a sanitised LD_LIBRARY_PATH + [ "$LD_LIBRARY_PATH" = "$FAKE_PATH" ] || (echo "LD_LIBRARY_PATH is not $FAKE_PATH but $LD_LIBRARY_PATH" && exit 1) + # Make sure things are back as we expect afterwards + module purge + [ "$LD_LIBRARY_PATH" = "$INITIAL_LD_LIBRARY__PATH" ] || (echo "LD_LIBRARY_PATH is not $INITIAL_LD_LIBRARY_PATH but $LD_LIBRARY_PATH" && exit 1) diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index 2ddcf194..ddee7b92 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -210,6 +210,31 @@ if os.getenv("EESSI_MODULE_STICKY") then load_message = load_message .. " (requires '--force' option to unload or purge)" end +-- make sure we are using a known locale +pushenv ("LANG", "C.utf8") +pushenv ("LC_ALL", "C.utf8") +pushenv ("LC_CTYPE", "C.utf8") +pushenv ("LC_MESSAGES", "C.utf8") + +-- avoid lesspipe problems on Debian system +pushenv ("LESSOPEN", "") + +-- Filter system paths from LD_LIBRARY_PATH +-- Needs to be reversible so first make a copy +append_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", os.getenv("LD_LIBRARY_PATH") or "") +-- on unload the variable will no longer exist +if mode() == "load" then + -- remove any standard paths + remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/lib") + remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/lib64") + remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/lib") + remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/lib64") + remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/local/lib") + remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/local/lib64") +end +-- now we can use pushenv to retain/restore the original value +pushenv ("LD_LIBRARY_PATH", os.getenv("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH") or "") + if mode() == "load" then LmodMessage(load_message) end From ff7192f3177731f990cf0baaa1a5a684eb06ce16 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Thu, 23 Oct 2025 11:52:55 +0200 Subject: [PATCH 2/8] Update 2023.06.lua --- init/modules/EESSI/2023.06.lua | 3 --- 1 file changed, 3 deletions(-) diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index ddee7b92..7b415287 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -216,9 +216,6 @@ pushenv ("LC_ALL", "C.utf8") pushenv ("LC_CTYPE", "C.utf8") pushenv ("LC_MESSAGES", "C.utf8") --- avoid lesspipe problems on Debian system -pushenv ("LESSOPEN", "") - -- Filter system paths from LD_LIBRARY_PATH -- Needs to be reversible so first make a copy append_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", os.getenv("LD_LIBRARY_PATH") or "") From e09c480fa8d0087c4fba83302fde0be52d69426a Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 23 Oct 2025 12:20:28 +0200 Subject: [PATCH 3/8] Print every character to see what is going wrong --- .github/workflows/tests_eessi_module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index 33b1cb19..2189d1a3 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -353,4 +353,4 @@ jobs: [ "$LD_LIBRARY_PATH" = "$FAKE_PATH" ] || (echo "LD_LIBRARY_PATH is not $FAKE_PATH but $LD_LIBRARY_PATH" && exit 1) # Make sure things are back as we expect afterwards module purge - [ "$LD_LIBRARY_PATH" = "$INITIAL_LD_LIBRARY__PATH" ] || (echo "LD_LIBRARY_PATH is not $INITIAL_LD_LIBRARY_PATH but $LD_LIBRARY_PATH" && exit 1) + [ "$LD_LIBRARY_PATH" = "$INITIAL_LD_LIBRARY__PATH" ] || (echo "LD_LIBRARY_PATH is not" $(echo "$INITAL_LD_LIBRARY_PATH" | od -c) "but" $(echo "$LD_LIBRARY_PATH" | od -c) && exit 1) From b87ff129760066e59cebd26179ccf3aae4337f21 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 23 Oct 2025 12:27:26 +0200 Subject: [PATCH 4/8] Typo fix --- .github/workflows/tests_eessi_module.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index 2189d1a3..42407d9e 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -353,4 +353,4 @@ jobs: [ "$LD_LIBRARY_PATH" = "$FAKE_PATH" ] || (echo "LD_LIBRARY_PATH is not $FAKE_PATH but $LD_LIBRARY_PATH" && exit 1) # Make sure things are back as we expect afterwards module purge - [ "$LD_LIBRARY_PATH" = "$INITIAL_LD_LIBRARY__PATH" ] || (echo "LD_LIBRARY_PATH is not" $(echo "$INITAL_LD_LIBRARY_PATH" | od -c) "but" $(echo "$LD_LIBRARY_PATH" | od -c) && exit 1) + [ "$LD_LIBRARY_PATH" = "$INITIAL_LD_LIBRARY_PATH" ] || (echo "LD_LIBRARY_PATH is not $INITIAL_LD_LIBRARY_PATH but $LD_LIBRARY_PATH" && exit 1) From 627be089a08c086ad0de6c560f97813d79342b78 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Thu, 23 Oct 2025 12:38:30 +0200 Subject: [PATCH 5/8] Explicitly set a locale to avoid dealing with Lmod behaviour around LC_ALL --- .github/workflows/tests_eessi_module.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index 42407d9e..9709f6f7 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -212,14 +212,17 @@ jobs: module unuse .github/workflows/modules module avail - # Store the initial environment (ignoring Lmod tables) - env | grep -v _ModuleTable | sort > "${initial_env_file}" + # Set a (safe) locale + export LC_ALL=C + + # Store the initial environment (ignoring Lmod tables and internal stack varibles) + env | grep -v _ModuleTable | grep -v __LMOD_STACK | sort > "${initial_env_file}" # Do (and undo) loading the EESSI module CPU_ARCH=$(./init/eessi_archdetect.sh -a cpupath) module load EESSI/${{matrix.EESSI_VERSION}} module unload EESSI/${{matrix.EESSI_VERSION}} - env | grep -v _ModuleTable | sort > "${module_cycled_file}" + env | grep -v _ModuleTable | grep -v __LMOD_STACK |sort > "${module_cycled_file}" # Now compare the two results (do not expose the files, as they contain the full environment!) if (diff "${initial_env_file}" "${module_cycled_file}" > /dev/null); then From 8ebad087d172f820945170a509275f5b9ee56634 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Thu, 23 Oct 2025 13:20:26 +0200 Subject: [PATCH 6/8] Don't fiddle with locale for now --- init/modules/EESSI/2023.06.lua | 6 ------ 1 file changed, 6 deletions(-) diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index 7b415287..eb6dd411 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -210,12 +210,6 @@ if os.getenv("EESSI_MODULE_STICKY") then load_message = load_message .. " (requires '--force' option to unload or purge)" end --- make sure we are using a known locale -pushenv ("LANG", "C.utf8") -pushenv ("LC_ALL", "C.utf8") -pushenv ("LC_CTYPE", "C.utf8") -pushenv ("LC_MESSAGES", "C.utf8") - -- Filter system paths from LD_LIBRARY_PATH -- Needs to be reversible so first make a copy append_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", os.getenv("LD_LIBRARY_PATH") or "") From a8382c72856d1c2dcfe35f0087e420143476fdd1 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Thu, 23 Oct 2025 13:21:26 +0200 Subject: [PATCH 7/8] Also remove locale setting in CI --- .github/workflows/tests_eessi_module.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests_eessi_module.yml b/.github/workflows/tests_eessi_module.yml index 9709f6f7..67ff9bd3 100644 --- a/.github/workflows/tests_eessi_module.yml +++ b/.github/workflows/tests_eessi_module.yml @@ -212,9 +212,6 @@ jobs: module unuse .github/workflows/modules module avail - # Set a (safe) locale - export LC_ALL=C - # Store the initial environment (ignoring Lmod tables and internal stack varibles) env | grep -v _ModuleTable | grep -v __LMOD_STACK | sort > "${initial_env_file}" From 5f2c89b66f4a9a13942678ce88017e72ab43cb13 Mon Sep 17 00:00:00 2001 From: ocaisa Date: Thu, 23 Oct 2025 13:29:11 +0200 Subject: [PATCH 8/8] Update 2023.06.lua --- init/modules/EESSI/2023.06.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/modules/EESSI/2023.06.lua b/init/modules/EESSI/2023.06.lua index eb6dd411..907dde81 100644 --- a/init/modules/EESSI/2023.06.lua +++ b/init/modules/EESSI/2023.06.lua @@ -215,7 +215,7 @@ end append_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", os.getenv("LD_LIBRARY_PATH") or "") -- on unload the variable will no longer exist if mode() == "load" then - -- remove any standard paths + -- remove any standard paths that can interfere with the compat layer remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/lib") remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/lib64") remove_path ("EESSI_DEFAULT_HOST_LD_LIBRARY_PATH", "/usr/lib")