From 5f314e41e94535635d66999d85d53a75ff51a6a8 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 3 Jul 2023 18:42:23 +0200 Subject: [PATCH] bugfix in loading modulefiles with a relative path --- Pmodules/modulecmd.bash.in | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index a3a148d..b453960 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -695,14 +695,20 @@ subcommand_load() { local moduledir='' find_modulefile current_modulefile rel_stage moduledir "${m}" "${modulepath[@]}" if [[ -z ${current_modulefile} ]]; then - local hints='' - get_load_hints hints - if [[ -z "${hints}" ]]; then - die_module_nexist "${m}" + local fname=$(std::get_abspath "${m}") + if [[ -r "${fname}" ]]; then + current_modulefile="${fname}" + rel_stage='stable' else - die_module_unavail "${m}${hints}" - fi - fi + local hints='' + get_load_hints hints + if [[ -z "${hints}" ]]; then + die_module_nexist "${m}" + else + die_module_unavail "${m}${hints}" + fi + fi + fi [[ ${m} == Pmodules/* ]] && [[ -n ${LOADEDMODULES} ]] && \ die_conflict "${m}" # continue if already loaded