Repository navigation
🐛 fix(seed): launch pip in legacy locales - #3681
Merged
Merged
Conversation
gaborbernat
force-pushed
the
fix/legacy-locale-pip-nu6
branch
2 times, most recently
from
November 20, 2026 09:10
f7015b4 to
7634987
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 10:09
gaborbernat
marked this pull request as draft
November 20, 2026 10:13
POSIX launchers encoded environment paths as UTF-8 even when their filesystem bytes used a legacy locale. The kernel then looked for an interpreter at a different path. Use an ASCII shell wrapper to reconstruct the interpreter's filesystem bytes for both seeders. Fixes pypa#3632
gaborbernat
force-pushed
the
fix/legacy-locale-pip-nu6
branch
from
November 20, 2026 10:17
7634987 to
2f3763c
Compare
gaborbernat
marked this pull request as ready for review
November 20, 2026 10:40
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.
At the merge base, the app-data seeder kept a direct pip launcher header when it fit on one line, even if the interpreter's filesystem bytes differed from UTF-8. The pip seeder also left such a header in place unless the path contained whitespace. In a legacy POSIX locale,
bin/pipthen names a different path and usually fails to start, whilepython -m pipworks. Both seeders now make the launcher start the environment's interpreter. Fixes #3632.The header used a different byte spelling
distlib's script maker encodes the interpreter path as UTF-8. The kernel uses the shebang's bytes to find that path, while Python reads the launcher as UTF-8. The codec check compares the filesystem bytes with UTF-8. On a mismatch, the shell wrapper uses ASCII octal escapes so
/bin/shreconstructs the absolute interpreter path. The app-data seeder selects that wrapper when the bytes differ.The pip seeder needed the same rewrite
The rewriter now also selects pip's direct header when the path bytes differ, replaces it with the same shell wrapper, and refreshes its RECORD entry. The activation check in #3412 and Xonsh changes in #3667, #3668, and #3671 concern activation scripts; they do not change direct seeded launchers.
Behavior changes
In a non-UTF-8 POSIX locale, seeded
piplaunchers work for non-ASCII paths whose filesystem bytes differ from UTF-8. Matching paths keep their existing header form, and Windows launcher handling is unchanged. Pip can still write mismatched launchers for packages installed later or after a pip upgrade. Realaa_DJ.iso88591tests cover both seeders with non-ASCII names, spaces, and shell punctuation; a raw byte path test covers surrogate escapes.Reported by oss-scanner: ANT-2026-NU6BEMWZ.