cea-hpc / modules

Environment Modules: provides dynamic modification of a user's environment
http://modules.sourceforge.net/
GNU General Public License v2.0
668 stars 102 forks source link

Only last value is retained when same variant is specified multiple times during extra match search #499

Closed xdelaruelle closed 1 year ago

xdelaruelle commented 1 year ago

When an extra specifier is specified several times it acts as an AND operation: envvar:BAR envvar:QUX means match modules that define both BAR and QUX environment variables.

However when it comes to variant value specification, only the last value specified is retained: foo=val1 foo=val2 is currently equivalent to foo=val2. During an extra match search, it would be expected that foo=val1 foo=val2 means foo=val1 AND foo=val2 to get same behavior than the one observed for extra specifier.

$ module show foo/1.0
-------------------------------------------------------------------
/path/to/modulefiles/foo/1.0:

variant         foo val1 val2 val3
setenv          BAR value
setenv          QUX value
-------------------------------------------------------------------
$ module avail -t -o "" env:BAR env:QUX
foo/1.0
$ module avail -t -o "" env:FOO env:QUX
$ module avail -t -o "" foo=val1 foo=val2
foo/1.0
$ module avail -t -o "" foo=val4 foo=val1
foo/1.0