Repository navigation
🐛 fix(xonsh): keep Tcl bytes in UTF-7 - #3709
Closed
gaborbernat wants to merge 27 commits into
Closed
gaborbernat wants to merge 27 commits into
gaborbernat wants to merge 27 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 #3660 kept non-ASCII Tcl library path bytes across locale changes in Xonsh, but its generated bytes literal could change when Xonsh read the script as UTF-7. The activator now writes those verified bytes as hexadecimal digits and reconstructs them when sourced. This completes the Xonsh path handling for draft advisory ANT-2026-174OWDGY.
Source decoding of embedded bytes
The previous
repr(bytes)rendering left some original ASCII path text inside the generated Python literal. UTF-7 can interpret part of that text as encoded characters before Xonsh parses the literal, changing the path bytes that activation exports. The new rendering contains only hexadecimal digits for the original path bytes. Xonsh reconstructs them with the built-inbytes.fromhexand then decodes them with its active filesystem codec, preserving the exported bytes across source and filesystem encoding changes even if the shell has a variable namedbytes.flowchart LR B[Verified path bytes] --> O[Old bytes literal with path text] O --> U[UTF-7 source decode may change text] U --> D[Different exported bytes] B --> H[New hexadecimal digits] H --> R[Reconstruct bytes at source time] R --> S[Original exported bytes] classDef bad fill:#ffd6d6,stroke:#c1121f,color:#5c0000; classDef ok fill:#d8f3dc,stroke:#2d6a4f,color:#1b4332; class O,U,D bad; class H,R,S ok;Behavior changes and checks
A benign Xonsh subprocess test now checks that a UTF-7 source session exports the original non-ASCII
TCL_LIBRARYbytes. The UTF-7 case fails against current main and passes with this change; the existing UTF-8 source case and a session that shadowsbytesalso pass. The same renderer handlesTK_LIBRARY. ASCII paths and Windows Unicode literals retain their previous behavior.Reported by
oss-scanner: ANT-2026-174OWDGY.Replaces #3667 after its merge was reverted.