Skip to content

Commit 03b5fda

Browse files
committed
Skip unload of depended mods on purge
When a module fails to unload during a `purge` sub-command, preserve loaded the modules it requires to keep environment consistent. Fixes #370
1 parent c778761 commit 03b5fda

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

modulecmd.tcl.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11560,7 +11560,7 @@ proc cmdModulePurge {} {
1156011560

1156111561
# unload one by one to ensure same behavior whatever auto_handling state
1156211562
# force it to handle loaded modules in violation state
11563-
eval cmdModuleUnload unload match 0 1 0 0 [lreverse [getLoadedModuleList]]
11563+
eval cmdModuleUnload unload match 0 1 0 1 [lreverse [getLoadedModuleList]]
1156411564

1156511565
popMsgRecordId 0
1156611566
}

testsuite/modules.50-cmds/377-error.exp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -784,14 +784,14 @@ setenv_path_var MODULES_LMPREREQ rce&rcd:rcd&rcc:rcc&rcb:rcb&rca
784784
unsetenv_path_var MODULES_LMCONFLICT
785785

786786
set ans [list]
787-
lappend ans [list setpath MODULES_LMPREREQ rcc&rcb]
788-
lappend ans [list setpath _LMFILES_ $mp/rcc]
789-
lappend ans [list setpath LOADEDMODULES rcc]
790-
lappend ans [list setpath MODULES_LMNOTUASKED rcc]
787+
lappend ans [list setpath MODULES_LMPREREQ rcc&rcb:rcb&rca]
788+
lappend ans [list setpath _LMFILES_ $mp/rca:$mp/rcb:$mp/rcc]
789+
lappend ans [list setpath LOADEDMODULES rca:rcb:rcc]
790+
lappend ans [list setpath MODULES_LMNOTUASKED rca:rcb:rcc]
791791
lappend ans [list ERR]
792-
set tserr [list {unload rce} {unload rcd} {unload rcc} \n[msg_unload rcc $err_evalabort]\n {unload rcb} {unload rca}]
792+
set tserr [list {unload rce} {unload rcd} {unload rcc} \n[msg_unload rcc $err_evalabort]\n\n[msg_unload rcb [err_deplo rcc]]\n\n[msg_unload rca [err_deplo rcb]]]
793793
testouterr_cmd_re sh {purge} $ans [join $tserr \n]
794-
# adding --force argument does not change a thing
794+
# adding --force argument does not change a thing currently
795795
testouterr_cmd_re sh {purge --force} $ans [join $tserr \n]
796796

797797

0 commit comments

Comments
 (0)