Protect Tcl sub-interpreter creation with quarantine mechanism - #689
Merged
Conversation
xdelaruelle
force-pushed
the
issue623
branch
3 times, most recently
from
August 24, 2026 18:58
ac59cd1 to
62e31ee
Compare
Environment variables put in quarantine are restored to their original value early at modulecmd.tcl start so that modulercs and modulefiles see the environment they expect. But the Tcl sub-interpreters used to evaluate these scripts are created after this restore and their initialization reads variables like TCL_LIBRARY from the environment. If such a variable designates a broken Tcl installation, for instance activated by a loaded module, sub-interpreter creation fails which prevents modulerc and modulefile evaluation. Set quarantine variables to their defined runtime value or unset them during sub-interpreter creation, then restore their original value once interp is created. A variable set during creation then unset afterward is also unset in the created interp: the env entry recorded in this interp at creation time is not removed by the unset made in the master interp and a read attempt on it would raise a "no such variable" error. Variable name validation of the run_quarantine configuration option is factored into the getQuarantineVarList procedure, shared with the quarantine release code run at start time. As this procedure clears duplicate entries, a variable listed twice is no more unset when released from quarantine. Fixes envmodules#623 Assisted-by: Claude:claude-fable-5 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
xdelaruelle
force-pushed
the
issue623
branch
2 times, most recently
from
August 25, 2026 05:19
dd692a7 to
4c69974
Compare
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.
Environment variables put in quarantine are restored to their original value early at
modulecmd.tclstart so that modulercs and modulefiles see the environment they expect. But the Tcl sub-interpreters used to evaluate these scripts are created after this restore and their initialization reads variables likeTCL_LIBRARYfrom the environment. If such a variable designates a broken Tcl installation, for instance activated by a loaded module, sub-interpreter creation fails which prevents modulerc and modulefile evaluation.Set quarantine variables to their defined runtime value or unset them during sub-interpreter creation, then restore their original value once interp is created.
Variable name validation of the
run_quarantineconfiguration option is factored into thegetQuarantineVarListprocedure, shared with the quarantine release code run at start time. As this procedure clears duplicate entries, a variable listed twice is no more unset when released from quarantine.Fixes #623