Skip to content

module_cmd: allow loading already-loaded modules - #578

Merged
climbfuji merged 1 commit into
JCSDA:spack-stack-devfrom
GMAO-SI-Team:fix/module-already-loaded
Aug 18, 2026
Merged

module_cmd: allow loading already-loaded modules#578
climbfuji merged 1 commit into
JCSDA:spack-stack-devfrom
GMAO-SI-Team:fix/module-already-loaded

Conversation

@mathomp4

Copy link
Copy Markdown
Collaborator

Summary

Backport Spack upstream PR spack#52752 to spack-stack-dev.

load_module() now treats an already-loaded module as a successful no-op.

Motivation

Module systems such as Lmod successfully accept a repeated module load, but leave LOADEDMODULES unchanged. Previously, Spack interpreted that unchanged value as a module-load failure. This occurs when an external compiler and MPI specification share prerequisite modules.

The change avoids false ModuleLoadError failures while preserving the existing validation for genuinely unsuccessful module loads.

Validation

This exact change, including the regression test, was merged upstream in spack#52752.

@mathomp4
mathomp4 requested a review from climbfuji August 18, 2026 16:32
@mathomp4
mathomp4 marked this pull request as ready for review August 18, 2026 16:32

@climbfuji climbfuji left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much, this is a life saver!

@climbfuji
climbfuji merged commit 515fa33 into JCSDA:spack-stack-dev Aug 18, 2026
9 of 11 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in spack-stack-2.2.x (2026 Q?) Aug 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants