Fix relative modulepath resolution during modulefile evaluation - #700
Open
xdelaruelle wants to merge 2 commits into
Open
xdelaruelle wants to merge 2 commits into
xdelaruelle wants to merge 2 commits into
Conversation
When conflict_unload is enabled, the conflicting loaded module is unloaded at the time the conflict, family or module unload command is evaluated. A variable set by the loading modulefile before this command is unset by this unload if the conflicting modulefile also sets it. Document this behavior as another reason to declare dependencies prior environment changes and cover it in the testsuite. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
A relative path entry in MODULEPATH is made absolute by the procedure which uses the directory of the modulefile being evaluated as base when an evaluation is ongoing. A module loaded from within a modulefile, with a "module load", "prereq" or "depends-on" command, is thus searched in a wrong directory and reported as not found. Relative modulepath entries refer to the current working directory of the module command, whatever the evaluation context. Add an option to the path resolution procedure to force this base directory and use it when resolving modulepath entries. The "is-used" modulefile command resolves its arguments relatively to the modulefile directory, so a raw relative MODULEPATH entry passed as argument does not match the entry once resolved from the current working directory. Check argument against the raw MODULEPATH content first, as "module unuse" does, to keep such argument recognized as used. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two changes coming out of the integration of Modules in OpenHPC.
A relative path entry in
MODULEPATHwas made absolute against the directory of the modulefile being evaluated when amodule load,prereqordepends-oncommand ran inside a modulefile. The required module was searched in a wrong directory and reported as not found. Relative modulepath entries now always refer to the current working directory of themodulecommand, whatever the evaluation context.is-usedis adjusted to still recognize a raw relative entry passed as argument, asmodule unusealready does, since its arguments resolve relatively to the modulefile directory. Tests cover both therelative/dirand./relative/dirforms.The second commit documents that, when
conflict_unloadis enabled, a variable set by the loading modulefile prior to itsconflict,familyormodule unloadcommand is lost if the unloaded conflicting modulefile also sets it. This is another reason to declare dependencies before environment changes. The behavior is covered in the testsuite.