Skip to content

Loading a module with a prereq ending with / leads to an error #640

Description

@mussetj

Describe the bug

When loading a module with a prereq ending with /, the load returns an error:

To Reproduce

Steps to reproduce the behavior:

 $ module load foo
Loading foo/1.0
  ERROR: Load of requirement bar/ failed

Location and content of any modulerc or modulefile involved:

$ tree
.
├── bar
│   └── 2.0
└── foo
    └── 1.0

 $ cat foo/1.0 
#%Module
setenv foo_var 1
prereq bar/

 $ cat bar/2.0 
#%Module
setenv bar_var 1

Expected behavior

The module should load without error

Error and debugging information

$ module --debug load foo
...
DEBUG interp-sync-env: unset var='::env(bar_var)', val='' on interp(s) __modfile_load_1_1 __modfile_load_1_2 __cachefile __modrc_1
DEBUG interp-sync-env: unset var='::env(foo_var)', val='' on interp(s) __modfile_load_1_1 __modfile_load_1_2 __cachefile __modrc_1
DEBUG restoreSettings: previously saved settings restored (#1)
DEBUG popSettings: previously saved settings flushed (#1)
DEBUG unsetState: report_sep_next unset

DEBUG setState: report_sep_next set to '1'
Loading foo/1.0
  Evaluate modulefile: '/path/to/my/modules/foo/1.0' as 'foo/1.0'
  Get modules: {bar/2.0 bar} matching 'bar/' in '/path/to/my/modules/'
  Select module: 'bar/2.0' (/path/to/my/modules/bar/2.0) matching 'bar/2.0'
  ERROR: Load of requirement bar/ failed
DEBUG unsetState: report_sep_next unset
...

Modules version and configuration

I cannot provide all the information for confidentiality reasons, but here is the main configuration:

$ module --version
Modules Release 5.6.0 (2025-07-31)
$ module config 
Modules Release 5.6.0 (2025-07-31)

- Config. name ---------.- Value (set by if default overridden) ---------------
abort_on_error            ml:reload:switch_unload
advanced_version_spec     1 (env-var)
auto_handling             1
avail_indepth             1
avail_output              modulepath:alias:dirwsym:sym:tag:variantifspec:key
avail_terse_output        modulepath:alias:dirwsym:sym:tag:variantifspec
cache_buffer_bytes        32768
cache_expiry_secs         0
collection_pin_tag        0
collection_pin_version    0
color                     auto (env-var)
colors                    hi=1:db=2:tr=2:se=2:er=91:wa=93:me=95:in=94:mp=1;94:di=94:al=96:va=93:sy=95:de=4:cm=92:aL=100:L=90;47:H=2:F=41:nF=31;43:S=46:sS=44:kL=30;48;5;109:W=30;43
conflict_unload           0
contact                   root@localhost
csh_limit                 4000
editor                    vi
extended_default          1 (env-var)
extra_siteconfig          <undef>
hide_auto_loaded          0
home                      /usr/share/Modules (env-var)
icase                     search (env-var)
ignore_cache              0
ignore_user_rc            0
ignored_dirs              CVS RCS SCCS .svn .git .SYNC .sos
implicit_default          1
implicit_requirement      1
list_output               header:idx:variant:sym:tag:key
list_terse_output         header
locked_configs            
logged_events             
logger                    /usr/bin/logger -t modules
mcookie_check             always (env-var)
mcookie_version_check     1
ml                        1
nearly_forbidden_days     14
pager                     /usr/bin/cat (env-var)
protected_envvars         <undef>
quarantine_support        1 (env-var)
rcfile                    <undef>
redirect_output           1
require_via               0
reset_target_state        __init__
run_quarantine            LD_LIBRARY_PATH LD_PRELOAD (env-var)
search_match              starts_with
set_shell_startup         1 (env-var)
shells_with_ksh_fpath     sh:bash:csh:tcsh (env-var)
silent_shell_debug        1 (env-var)
siteconfig                /etc/environment-modules/siteconfig.tcl
source_cache              1 (env-var)
spider_indepth            1
spider_output             modulepath:alias:dirwsym:sym:tag:variantifspec:via:key
spider_terse_output       modulepath:alias:dirwsym:sym:tag:variantifspec
sticky_purge              silent (env-var)
tag_abbrev                auto-loaded=aL:loaded=L:hidden=H:hidden-loaded=H:forbidden=F:nearly-forbidden=nF:sticky=S:super-sticky=sS:keep-loaded=kL:warning=W
tag_color_name            
tcl_ext_lib               /usr/lib64/libtclenvmodules.so
tcl_linter                nagelfar.tcl
term_background           dark
term_width                0
unique_name_loaded        0
unload_match_order        returnlast
variant_shortcut          
verbosity                 concise (env-var)
wa_277                    0

Additional context

If we change the prereq to:

prereq bar@

The loading proceeds without error

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions