From f0e2d501d92a0db44da2ed82e39ee1d17565acf3 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Mon, 16 Mar 2026 15:59:44 +0100 Subject: [PATCH] BUGFIX: modulecmd: unbound variable fixed in get_load_hints() --- CHANGELOG.md | 16 ++++++++++++++++ Pmodules/modulecmd.bash.in | 5 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c383b6d..3bb66cb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,22 @@ ## Version 2.0.5 ### modulecmd +* Bugfix: Under some conditions it could happen, that the variable + GroupDepths($group) was undefined in the function get\_load\_hints(). + The PR for issue #1368 didn't fix the bug. + (#1384) +* Bugfixes: cherry-pick fixes for issues #1368 and #1371 + (#1375) + +### build-system +* Enhancemnet: It is now possible to specify a sub-directory relative to + $SRC_DIR used by cmake/autotools in the YAML config file. + (#1382) +* Bugfix: remove comments while reading YAML config files + (#1380) +* Bugfix: test whether a variant has to be build or not fixed + (#1377) + ## Version 2.0.4 diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index c7dde60..fe5c1e4 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -799,7 +799,8 @@ subcommand_load() { local -n output="$1" # [out] ref.var to return result output='' - local -- search_result="$(set +x; subcommand_search "${m}" -a --no-header 2>&1)" + local -- search_result='' + find_matching_modules search_result -a "${m}" local -- relstage='' while read -r -a line; do (( ${#line[@]} == 0 )) && continue @@ -816,7 +817,7 @@ subcommand_load() { output+="module use ${group}; " fi local -i n=$(( ${GroupDepths[${group}]}/2 )) - output+="module load ${line[*]:4:$n} ${line[0]}\n" + output+="module load ${line[*]:5:$n} ${line[0]}\n" done <<<"${search_result}" if [[ -n ${output} ]]; then