mirror of
https://github.com/envmodules/modules.git
synced 2026-06-14 00:42:43 +08:00
Allow unload of sticky modules on restore sub-cmd
Allow the unload of sticky modules when restoring collection. Goal is to be able to restore designated collection as it was saved, thus without the loaded sticky modules. If such collections were saved without the sticky modules in it, it means that these sticky modules can safely be unloaded when moving to the collection state. As a result, using the --force option is of no use for restore sub-command. This change does not impact super-sticky modules. Such modules cannot be unloaded during a restore, even if forced. With this change, behavior of restore sub-command with sticky modules is aligned with Lmod.
This commit is contained in:
@@ -219,7 +219,8 @@ proc execute-modulefile {modfile modname modnamevrvar modspec {up_namevr 1}\
|
||||
lpopState modulefile
|
||||
knerror [getStickyUnloadMsg super-sticky]
|
||||
} elseif {[isModuleTagged $modname sticky 1] && [currentState\
|
||||
reloading_sticky] ne $modname} {
|
||||
reloading_sticky] ne $modname && [currentState unloading_sticky] ne\
|
||||
$modname} {
|
||||
if {[getState force]} {
|
||||
reportWarning [getStickyForcedUnloadMsg]
|
||||
} else {
|
||||
|
||||
@@ -647,17 +647,14 @@ proc cmdModuleRestore {args} {
|
||||
} else {
|
||||
set modvr $mod
|
||||
}
|
||||
if {[set sticky_reload [isStickinessReloading $modvr $mod_to_load]]} {
|
||||
lappendState reloading_sticky $mod
|
||||
}
|
||||
# sticky modules can be unloaded when restoring collection
|
||||
lappendState unloading_sticky $mod
|
||||
if {[set supersticky_reload [isStickinessReloading $modvr $mod_to_load\
|
||||
super-sticky]]} {
|
||||
lappendState reloading_supersticky $mod
|
||||
}
|
||||
cmdModuleUnload unload match 0 0 0 0 $mod
|
||||
if {$sticky_reload} {
|
||||
lpopState reloading_sticky
|
||||
}
|
||||
lpopState unloading_sticky
|
||||
if {$supersticky_reload} {
|
||||
lpopState reloading_supersticky
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user