Skip to content

Fix implicit_requirement change from sourced modulefile - #743

Merged
xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:issue740
Nov 18, 2026
Merged

xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:issue740

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

The module modulefile command tests the implicit_requirement option twice: before running the sub-command to push an entry on the inhibit_req_record state, then after to pop it. When the sub-command is config implicit_requirement <value>, the option value changes between these two tests.

When the option is disabled this way from an initialization rc file or a sourced modulefile, the state is popped without having been pushed, which raises an error as this state is not defined. When the option is enabled, the pushed entry is never removed.

The condition is now evaluated once before running the sub-command and its result reused afterward, so push and pop are always paired.

Fixes #740

The module modulefile command tests the implicit_requirement option
twice: before running the sub-command to push an entry on the
inhibit_req_record state, then after to pop it. When the sub-command
is "config implicit_requirement <value>", the option value changes
between these two tests.

When the option is disabled this way from an initialization rc file or
a sourced modulefile, the state is popped without having been pushed,
which raises an error as this state is not defined. When the option is
enabled, the pushed entry is never removed.

Evaluate the condition once before running the sub-command and reuse
its result afterward, so push and pop are always paired.

Fixes envmodules#740

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@xdelaruelle
xdelaruelle merged commit 86fb420 into envmodules:main Nov 18, 2026
30 of 31 checks passed
@xdelaruelle
xdelaruelle deleted the issue740 branch November 18, 2026 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error when implicit_requirement is set to 0 in initrc

1 participant