diff --git a/CHANGELOG.md b/CHANGELOG.md index 747e4fb..487a916 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ ## Version 2.0.3 ### modulecmd +* Bugfix in unloading modules. Under certain conditions unloading a module + failed due to a wrong check in the test whether a module is loaded or not. + (#1340) * Misleading error message fixed if system configuration file is not readable. (#1316, #1331) diff --git a/Pmodules/modulecmd.bash.in b/Pmodules/modulecmd.bash.in index 8fc94ac..a6078c2 100644 --- a/Pmodules/modulecmd.bash.in +++ b/Pmodules/modulecmd.bash.in @@ -1073,13 +1073,10 @@ subcommand_unload() { for arg in "${args[@]}"; do # is the module loaded? for lmfile in "${_lmfiles_[@]}" '_zzzz_'; do - if [[ $lmfile =~ ${arg} ]]; then - break - fi + [[ /${lmfile} =~ /${arg}$ ]] && break done - if [[ "${lmfile}" == '_zzzz_' ]]; then - continue - fi + [[ "${lmfile}" == '_zzzz_' ]] && continue + # yes, module has been loaded is_modulefile modulecmd "${lmfile}" || die_module_not_a_modulefile "${arg}"