-
Couldn't load subscription status.
- Fork 117
Description
According to the "module" manpage, the "module use" command should behave as follows:
use directory [directory...]
use [-a|--append] directory [directory...]
Prepend directory to the MODULEPATH environment
variable. The --append flag will append the
directory to MODULEPATH.
However, what actually happens depends on the initial contents of MODULEPATH. For example:
$ module use /tmp
$ module use /home
$ echo $MODULEPATH
/home:/tmp
$ module use /tmp
/home:/tmp
So it appears that the search order in the MODULEPATH will not change if a specified directory is in the initial MODULEPATH. This applies to at least the following versions of modules - 3.2.6 & 3.2.7 (C-version) and 1.146 (TCL-version).
The actual behaviour of the "module use" could be considered a bug, because it does not conform with the manpage. This "bug" could be addressed in a few ways, such as:
- Change the manpage to describe the actual behaviour.
- Change the actual behaviour to match the manpage.
- Avoid "module use" commands and set MODULEPATH directly.
I would prefer option 2 over option 1, because the current behaviour can cause confusing errors in scripts. For example, if a script inherits a MODULEPATH from the environment, the MODULEPATH may not be set as expected by an internal "module use" command. Option 3 avoids the problem, but it may not be future-proof.
Reported by: mw00ds