From 2fbebfdf98362ce2c460e18794287daf3e73b97d Mon Sep 17 00:00:00 2001 From: Achim Gsell Date: Wed, 21 Jun 2023 13:54:46 +0200 Subject: [PATCH] modulecmd: using/unusing group/modulepath fixed using a group must have precedence over a directory containing modulefiles. Otherwise something like `module load Tools` doesn't work as expected if Tools is a subdirectory of the current working directory. --- Pmodules/modulecmd.bash.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index d5d368e..30f04a4 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1577,11 +1577,6 @@ subcommand_use() { use_overlay "${arg}" return $? fi - if [[ -d ${arg} ]]; then - local dir=$(cd "${arg}" && pwd -L) - ${add2path_func} MODULEPATH "${dir}" - return $? - fi if [[ ! -v GroupDepths[${arg}] ]]; then # this scan is required if a new group has been # create inside an used overlay @@ -1592,6 +1587,11 @@ subcommand_use() { use_group "${arg}" return $? fi + if [[ -d ${arg} ]]; then + local dir=$(cd "${arg}" && pwd -L) + ${add2path_func} MODULEPATH "${dir}" + return $? + fi die_invalid_value "use flag, group, overlay or directory" \ "${arg}" } # use () @@ -1745,7 +1745,7 @@ subcommand_unuse() { return 0 fi if [[ -d ${arg} ]]; then - local dir=$(cd "${arg} && pwd -L") + local dir=$(std::get_abspath "${arg}") std::remove_path MODULEPATH "${dir}" fi if [[ -n ${GroupDepths[${arg}]} ]]; then