Repository navigation
🐛 fix(activate): preserve Tcl and Tk paths - #3660
Merged
Merged
Conversation
gaborbernat
marked this pull request as draft
November 20, 2026 06:34
gaborbernat
marked this pull request as ready for review
November 20, 2026 06:48
This was referenced Nov 20, 2026
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.
PR #3645 verified Tcl library bytes when generating activation scripts, but its Xonsh script still embedded a Unicode literal. Sourcing that script under a different POSIX locale could export different path bytes. Xonsh now reconstructs the verified bytes with its active filesystem codec. The follow-up also restores non-ASCII Tk paths derived from a verified Tcl source. This follows draft advisory ANT-2026-174OWDGY.
Xonsh activation across locales
Xonsh's ASCII literal quoting kept the generated script readable, but preserved the path as Unicode text. A later legacy locale could encode that text to different bytes on export. The new substitution embeds the UTF-8 bytes verified during generation and decodes them when sourced, using the active filesystem codec. ASCII paths and Windows Unicode paths retain their earlier rendering.
flowchart LR V[Verified UTF-8 path bytes] --> O[Old Xonsh Unicode literal] O --> M[Later locale may export different bytes] V --> N[New bytes literal] N --> D[Decode with active filesystem codec] D --> S[Export original bytes] classDef bad fill:#ffd6d6,stroke:#c1121f,color:#5c0000; classDef ok fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332; class O,M bad; class N,D,S ok;Derived Tk paths
Python-discovery can derive a Tk library path from Tcl when
TK_LIBRARYis unset. The merged check dropped non-ASCII derived paths in that case. The follow-up retains one when the rawTCL_LIBRARYbytes match the recorded Tcl path and the derived Tk path encodes to the same UTF-8 bytes that the script will write. An explicitTK_LIBRARYstill requires its own byte match.GraalPy FIFO test gate
PR #3662 found that GraalPy does not expose
os.mkfifo, so the FIFO metadata test failed before reaching its assertions. This branch includes its capability guard, allowing the test to run on interpreters that provide FIFOs and skip where they are unavailable. The combined branch lets the GraalPy and PyPy suites check the Tcl fix without either merged regression blocking the other.Test coverage
A Xonsh subprocess test checks the exported
TCL_LIBRARYbytes after activation in a C locale. Windows generation checks that non-ASCII Tcl and Tk paths remain Unicode literals; I also ran it with legacy filesystem encoding in the Windows VM. The Tcl discovery integration test from #3645 now runs only on CPython: PyPy reports its bundled Tcl library path rather than the test's temporaryTCL_LIBRARYdirectory, which caused the PyPy 3.11 CI failure.Reported by
oss-scanner: ANT-2026-174OWDGY.