From fcec9f77c205095bdfc94e3a1252fda30985c3fa Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 10 May 2021 15:55:19 +0200 Subject: [PATCH] modulecmd: restore some env.vars after loading Pmodules module --- Pmodules/modulecmd.bash.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 5599f5e..871caf0 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -2270,7 +2270,16 @@ fi if [[ -n ${PMODULES_ENV} ]]; then eval "$("${base64}" -d <<< "${PMODULES_ENV}" 2>/dev/null)" if [[ -z ${Version} ]] || [[ ${Version} != ${PMODULES_VERSION} ]]; then + # the Pmodules version changed! + # we save _LMFILES_ and LOADEDMODULES and restore them + # later. Otherwise the Pmodules module would not be listed + # by module list + declare saved_LMFILES_="${_LMFILES_}" + declare saved_LOADEDMODULES="${LOADEDMODULES}" pmodules_init + _LMFILES_="${saved_LMFILES_}" + LOADEDMODULES="${saved_LOADEDMODULES}" + export_env _LMFILES_ LOADEDMODULES fi else pmodules_init