From e08072c22ebde675d683c70ad0afd3f310ef3023 Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Fri, 14 Oct 2016 13:34:13 +0200 Subject: [PATCH] Pmoules/modulecmd.bash.in - bugfix in subcommand_avail(): resan_groups() was called without args - get_group_deth2(): return 0 if group is empty --- Pmodules/modulecmd.bash.in | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 5f1b8d6..3225483 100755 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1119,7 +1119,7 @@ subcommand_avail() { done output_function=${output_function:-human_readable_output} if [[ "${opt_all_groups}" = 'yes' ]]; then - rescan_groups + rescan_groups "${PMODULES_ROOT}" fi if (( ${#pattern[@]} == 0 )); then pattern+=( '' ) @@ -1162,6 +1162,10 @@ get_group_depth2 () { local -a tmp2=( ${tmp//\// } ) local depth=${#tmp2[@]} (( depth-=4 )) + # if a group doesn't contain a module yet, depth would be -4 + # instead of 0 + # :FIXME: better solution? + (( depth == -4 )) && (( depth = 0 )) GroupDepths[$group]=${depth} } @@ -1169,7 +1173,7 @@ get_group_depth2 () { # $1: root # $2: group # -get_group_depth2 () { +get_group_depth () { local -r root="$1" local -r group="$2"