Skip to content

Protect Tcl sub-interpreter creation with quarantine mechanism - #689

Merged
xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:issue623
Aug 25, 2026
Merged

Protect Tcl sub-interpreter creation with quarantine mechanism#689
xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:issue623

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

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.

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 #623

@xdelaruelle
xdelaruelle force-pushed the issue623 branch 3 times, most recently from ac59cd1 to 62e31ee Compare August 24, 2026 18:58
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
xdelaruelle force-pushed the issue623 branch 2 times, most recently from dd692a7 to 4c69974 Compare August 25, 2026 05:19
@xdelaruelle
xdelaruelle merged commit 7531336 into envmodules:main Aug 25, 2026
20 checks passed
@xdelaruelle
xdelaruelle deleted the issue623 branch August 25, 2026 17:24
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.

Protect Tcl sub-interpreters with quarantine mechanism

1 participant