cea-hpc / modules

Environment Modules: provides dynamic modification of a user's environment
http://modules.sourceforge.net/
GNU General Public License v2.0
668 stars 102 forks source link

Family #465

Closed zzxtty closed 1 year ago

zzxtty commented 1 year ago

Describe the bug

Using a dash in a module name causes an error when using family in the module file.

To Reproduce

Steps to reproduce the behavior:

Add the following to the module file:

family bids-validator

This results in:

% module load bids-validator
Loading bids-validator/1.9.5
  Module ERROR: Invalid family name 'bids-validator'
        while executing
    "family bids-validator"
        (file "/software/system/modules/NaN/el8/bids-v'alidator/1.9.5" line 7)
    Please contact <root@localhost>
%

Changing "family" in the module file to "conflict" resolves the issue, as does removing the dash.

Modules version and configuration

Modules Release 5.1.1 (2022-05-31)
xdelaruelle commented 1 year ago

Many thanks for your report.

As indicated in family documentation:

name should be a non-empty string only containing characters that could be part of an environment variable name (i.e., [a-zA-Z0-9_]).

family creates an environment variable named MODULES_FAMILY_<NAME>. So name should not contain a dash character as it is not accepted in env var name on most shells.

$ export FOO-BAR=test
bash: export: `FOO-BAR=test': not a valid identifier
zzxtty commented 1 year ago

Oops, I managed to completely blanked that last line in the documentation. I guess that will teach me not to rush out bug reports a few minutes before a 3 hour meeting.

Thanks for the quick response.