Skip to content

module avail always returns 0 for an existing module dir but non-existing module #89

@bedroge

Description

@bedroge

While working on #86, I noticed that the module avail <whatever> command always returned 0 for me, even if a module for <whatever> does not exist:

[EESSI pilot 2021.03] $ module avail EasyBuild/4.5.0
No module(s) or extension(s) found!
Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching
any of the "keys".


[EESSI pilot 2021.03] $ echo $?
0
[EESSI pilot 2021.03] $ module avail EasyBuild/4.3.4

 /cvmfs/pilot.eessi-hpc.org/2021.03/software/linux/x86_64/intel/haswell/modules/all 
   EasyBuild/4.3.4

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching
any of the "keys".


[EESSI pilot 2021.03] $ echo $?
0
[EESSI pilot 2021.03] $ module avail ThisDoesNotExist
No module(s) or extension(s) found!
Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching
any of the "keys".


[EESSI pilot 2021.03] $ echo $?
0

When building a new stack from scratch, you don't notice this, because the $MODULEPATH then still points to a non-existing directory, in which case module avail does return 1:

[EESSI pilot 2021.03] $ export MODULEPATH=/does/not/exist
[EESSI pilot 2021.03] $ module avail EasyBuild
Lmod has detected the following error:  module avail is not
possible. MODULEPATH is not set or not set with valid paths.



[EESSI pilot 2021.03] $ echo $?
1

But if you need to update EasyBuild, as was necessary for #86, this is annoying.
A possible solution would be to use module spider or module is-avail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions