TACC / Lmod

Lmod: An Environment Module System based on Lua, Reads TCL Modules, Supports a Software Hierarchy
http://lmod.readthedocs.org
Other
489 stars 126 forks source link

`bad argument` error on `describe` of non-existent collection #688

Closed JohnWestlund closed 7 months ago

JohnWestlund commented 7 months ago

Describe the bug Issuing a describe command on a non-existent collection results in a less than intuitive error message with a traceback.

To Reproduce Steps to reproduce the behavior:

$ lmod savelist
$ lmod describe foo

Output

$ env -i LMOD_ROOT=$LMOD_ROOT USER=$USER ./bug_report_template.sh
No named collections.
/usr/bin/lua: /usr/share/lmod/lmod/libexec/MT.lua:281: bad argument #1 to 'open' (string expected, got nil)
stack traceback:
    [C]: in function 'io.open'
    /usr/share/lmod/lmod/libexec/MT.lua:281: in function 'MT.reportContents'
    /usr/share/lmod/lmod/libexec/cmdfuncs.lua:752: in function 'CollectionLst'
    /usr/share/lmod/lmod/libexec/lmod:514: in function 'main'
    /usr/share/lmod/lmod/libexec/lmod:585: in main chunk
    [C]: in ?

Expected behavior Error message than is intuitively understandable for a standard user.

Desktop (please complete the following information):

Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu

module [options] sub-command [args ...]

Help sub-commands:

help prints this message help module [...] print help message from module(s)

Loading/Unloading sub-commands:

load | add module [...] load module(s) try-load | try-add module [...] Add module(s), do not complain if not found del | unload module [...] Remove module(s), do not complain if not found swap | sw | switch m1 m2 unload m1 and load m2 purge unload all modules refresh reload aliases from current list of modules. update reload all currently loaded modules.

Listing / Searching sub-commands:

list List loaded modules list s1 s2 ... List loaded modules that match the pattern avail | av List available modules avail | av string List available modules that contain "string". category | cat List all categories category | cat s1 s2 ... List all categories that match the pattern and display their modules overview | ov List all available modules by short names with number of versions overview | ov string List available modules by short names with number of versions that contain "string" spider List all possible modules spider module List all possible version of that module file spider string List all module that contain the "string". spider name/version Detailed information about that version of the module. whatis module Print whatis information about module keyword | key string Search all name and whatis that contain "string".

Searching with Lmod:

All searching (spider, list, avail, keyword) support regular expressions:

-r spider '^p' Finds all the modules that start with p' orP' -r spider mpi Finds all modules that have "mpi" in their name. -r spider 'mpi$ Finds all modules that end with "mpi" in their name.

Handling a collection of modules:

save | s Save the current list of modules to a user defined "default" collection. save | s name Save the current list of modules to "name" collection. reset The same as "restore system" restore | r Restore modules from the user's "default" or system default. restore | r name Restore modules from "name" collection. restore system Restore module state to system defaults. savelist List of saved collections. describe | mcc name Describe the contents of a module collection. disable name Disable (i.e. remove) a collection.

Deprecated commands:

getdefault [name] load name collection of modules or user's "default" if no name given. ===> Use "restore" instead <==== setdefault [name] Save current list of modules to name if given, otherwise save as the default list for you the user. ===> Use "save" instead. <====

Miscellaneous sub-commands:

is-loaded modulefile return a true status if module is loaded is-avail modulefile return a true status if module can be loaded show modulefile show the commands in the module file. use [-a] path Prepend or Append path to MODULEPATH. unuse path remove path from MODULEPATH. tablelist output list of active modules as a lua table.

Important Environment Variables:

LMOD_COLORIZE If defined to be "YES" then Lmod prints properties and warning in color.

------------------------------------------------------------------------------------------------------------------------------------------------

Lmod Web Sites

Documentation: https://lmod.readthedocs.org GitHub: https://github.com/TACC/Lmod SourceForge: https://lmod.sf.net TACC Homepage: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod

To report a bug please read https://lmod.readthedocs.io/en/latest/075_bug_reporting.html

false

rtmclay commented 7 months ago

Thanks for the bug report. I have updated the testing branch which show to me that this now works for me. Please try out the "testing" branch to see if it works for you.

JohnWestlund commented 7 months ago

Looks good. Thanks so much for the quick turn around!