Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"module use" does not conform with manpage #60

@xdelaruelle

Description

@xdelaruelle

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:

  1. Change the manpage to describe the actual behaviour.
  2. Change the actual behaviour to match the manpage.
  3. 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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions