From ec147e78be5d7f635b69dde42f6f28b40ba235eb Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Thu, 9 Dec 2021 17:56:34 +0100 Subject: [PATCH] modulecmd: exit with err mesg if (un)use_group() is called for hierarchical group --- Pmodules/modulecmd.bash.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 51cdd4b..6772c84 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1488,6 +1488,12 @@ subcommand_use() { #.............................................................. use_group() { + if (( ${GroupDepths[${arg}]} > 0 )); then + # argument is a hierarchical group in our root + std::die 3 "%s %s: %s -- %s" \ + "${CMD}" "${subcommand}" \ + "illegal group" \ + "${arg}" std::append_path UsedGroups "$1" local overlay group for overlay in "${OverlayList[@]}"; do @@ -1684,6 +1690,14 @@ subcommand_unuse() { #.............................................................. unuse_group() { + if (( ${GroupDepths[${arg}]} > 0 )); then + # argument is a hierarchical group in our root + std::die 3 "%s %s: %s -- %s" \ + "${CMD}" "${subcommand}" \ + "illegal group" \ + "${arg}" + fi + local var="PMODULES_LOADED_${arg^^}" if [[ -n "${!var}" ]]; then std::die 3 "%s %s: %s -- %s" \