From aa4838ed2e0017102b9c574994d7d9ddb40c0a76 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 30 Jun 2022 17:54:04 +0200 Subject: [PATCH] modulecmd: bugfix if a Pmodule module have been loaded after loading a Pmodule module the module was not displayed with 'module list', this has been fixed --- Pmodules/modulecmd.bash.in | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 4c4a362..133a8b8 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -2757,8 +2757,21 @@ if [[ -n ${PMODULES_ENV} ]]; then eval "$("${base64}" -d <<< "${PMODULES_ENV}" 2>/dev/null)" fi if [[ -z ${Version} ]] || [[ ${Version} != ${PMODULES_VERSION} ]]; then + # this can only happen if the last command was + # module load Pmodules/${PMODULES_VERSION} + # + # the values these two variables must be saved before initialising + declare _tmp_loaded_modules_="${LOADEDMODULES}" + declare _tmp_lmfiles_="${_LMFILES_}" + pmodules_init - #g_env_must_be_saved='yes' + + # restore and export + LOADEDMODULES="${_tmp_loaded_modules_}" + _LMFILES_="${_tmp_lmfiles_}" + export_env \ + LOADEDMODULES \ + _LMFILES_ fi if (( ${#GroupDepths[@]} == 0 )); then