Skip to content

Commit ab1a4b5

Browse files
committed
Fix req search when searched mod defines a singular req
Fix extra specifier requirement search when module searched is also defining a requirement and is the sole module to define it. Fixes #495
1 parent b4f741c commit ab1a4b5

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

NEWS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Modules 5.3.1 (not yet released)
1919
fish as configuration snippet for this shell.
2020
* Fix extra specifier search to evaluate module matching requirement query.
2121
(fix issue #494)
22+
* Fix extra specifier requirement search when module searched is also defining
23+
a requirement and is the sole module to define it. (fix issue #495)
2224

2325

2426
Modules 5.3.0 (2023-05-14)

tcl/modscan.tcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ proc getModMatchingExtraSpec {pxtlist} {
264264
prereq-any depends-on always-load load-any try-load switch\
265265
switch-on switch-off}} {
266266
if {[dict exists $::g_scanModuleElt $elt]} {
267-
foreach modspec [dict get $::g_scanModuleElt $elt] {
267+
foreach {modspec values} [dict get $::g_scanModuleElt $elt] {
268268
# modEq proc has been initialized in getModules phase #2
269269
if {[modEq $modspec $name eqstart 1 5 1]} {
270270
# possible duplicate module entry in result list

testsuite/modulefiles.4/extra/1.0

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ if {[info exists env(TESTSUITE_EXTRA)]} {
170170
load7 {
171171
module load extra/1.0
172172
}
173+
load8 {
174+
module load xtfoo/1.0
175+
}
173176
module-err1 {
174177
module unk foo
175178
}

testsuite/modules.51-scan/043-extra_spec-require.exp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,11 @@ setenv_var TESTSUITE_EXTRA load7
340340
testouterr_cmd sh {avail -t extra load:extra/1.0} OK $tserr
341341
testouterr_cmd sh {ml av -t extra load:extra/1.0} OK $tserr
342342

343+
# module requiring another one, querying module defining the
344+
# requirement not the required module
345+
setenv_var TESTSUITE_EXTRA load8
346+
testouterr_cmd sh {ml av -t extra load:extra/1.0} OK {}
347+
343348

344349
#
345350
# module erroneous commands

0 commit comments

Comments
 (0)