Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ Modules 5.8.0 (not yet released)
commands to support modulerc files written for Lmod. They are aliases of
:mfcmd:`module-forbid` and :mfcmd:`module-hide` with ``--regexp`` option
set.
* Fix error raised when the :mconfig:`implicit_requirement` configuration
option is changed with the :subcmd:`config` sub-command from an
initialization rc file or a sourced modulefile. (fix issue #740 with
contribution from Achim Gsell)


.. _5.7 release notes:
Expand Down
6 changes: 4 additions & 2 deletions tcl/mfcmd.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,9 @@ proc module {command args} {
knerrorModule 0 "Command '$command' not supported"
}
# no requirement should be recorded this module load/unload/switch cmd
if {$not_req || ![getConf implicit_requirement]} {
# test made once as config sub-command may change implicit_requirement
set inhibit_req [expr {$not_req || ![getConf implicit_requirement]}]
if {$inhibit_req} {
lappendState inhibit_req_record [currentState evalid]
}

Expand All @@ -2718,7 +2720,7 @@ proc module {command args} {
lpopState commandname
lpopState always_read_full_file

if {$not_req || ![getConf implicit_requirement]} {
if {$inhibit_req} {
lpopState inhibit_req_record
}

Expand Down
21 changes: 21 additions & 0 deletions testsuite/modules.50-cmds/430-implicit-req.exp
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,27 @@ unsetenv_var __MODULES_LMTAG
unsetenv_loaded_module


#
# change implicit_requirement with config sub-command from sourced file
#

set modfile [file join [pwd] impreqconfig.mod]
set fid [open $modfile w]
puts $fid {#%Module
module config implicit_requirement $env(TESTSUITE_IMPLICIT_REQ)}
close $fid

foreach {cur new} {1 0 0 1 1 1 0 0} {
setenv_var MODULES_IMPLICIT_REQUIREMENT $cur
setenv_var TESTSUITE_IMPLICIT_REQ $new
set ans [list [list set MODULES_IMPLICIT_REQUIREMENT $new]]
testouterr_cmd sh "source $modfile" $ans {}
}

unsetenv_var TESTSUITE_IMPLICIT_REQ
file delete $modfile


#
# Cleanup
#
Expand Down
Loading