Skip to content

module show in modules relying on variables set in other modules fails #840

Description

@Flamefire

Describe the bug

We have modules that reference variables of other modules like:
setenv("CUOBJDUMP_PATH", os.getenv("CUDA_HOME") .. "/bin/cubjdump")
as CUDA_HOME is not set in a clean environment (no modules loaded) this fails with "attempt to concatenate a nil value"

To Reproduce

Have a module with e.g.:

depends_on("CUDA/12.6.0")
setenv("CUOBJDUMP_PATH", os.getenv("CUDA_HOME") .. "/bin/cubjdump")

Call module show <thatmodule> and observe the bug while module load <thatmodule> works.

Expected behavior

I'm not fully sure what a solution would be but would like to ask for ideas as the issue seems to be easy to encounter.
A downstream fix might be something like os.getenv("CUDA_HOME") or "$CUDA_HOME" but that has 2 problems:
When the variable is unset or empty on module load it will hide that silently causing later subtle issues.
So maybe LMod has better means of handling this only during module show, maybe something like getenv_with_default_on_module_show

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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