Repository navigation
🐛 fix(activate): preserve Tcl and Tk paths - #3708
Closed
gaborbernat wants to merge 28 commits into
Closed
gaborbernat wants to merge 28 commits into
gaborbernat wants to merge 28 commits into
Conversation
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Pin the pre-commit hook to [simplint 0.14.2](https://github.com/gaborbernat/simplint/releases/tag/0.14.2). This release starts larger files earlier during parallel checks and sizes cache reads to the archive on disk. Give bare `Final` annotations explicit types across virtualenv, maintenance tasks and tests. The wheel installer also declares its lazy `posixpath` import. Refresh the CodeQL mutant patches for the new annotations. The macOS GraalPy reseeding test timed out while uninstalling pip. Collect each package directory once when cleaning up files from pip's RECORD. The test also uses the existing fixture that keeps coverage out of pip's subprocesses.
…3588) Co-authored-by: Bernát Gábor <[email protected]>
Co-authored-by: Bernát Gábor <[email protected]>
…pypa#3591) Co-authored-by: Bernát Gábor <[email protected]>
Co-authored-by: Bernát Gábor <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
gaborbernat
added a commit
to gaborbernat/virtualenv
that referenced
this pull request
Nov 20, 2026
Tcl library paths and Xonsh activation values could change when a script was sourced under a different text or filesystem codec. Check recorded Tcl bytes, emit encoding-independent Xonsh source, and refuse path text that cannot round-trip through the active filesystem codec. Refs pypa#3743 Refs pypa#3708 Refs pypa#3709 Refs pypa#3729 Refs pypa#3717
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.Replaces #3660 after its merge was reverted.