Skip to content

🐛 fix(seed): contain reseeding and launcher paths - #3699

Merged
gaborbernat merged 7 commits into
pypa:mainfrom
gaborbernat:fix/3627-seed-metadata-special-files
Nov 20, 2026
Merged

gaborbernat merged 7 commits into
pypa:mainfrom
gaborbernat:fix/3627-seed-metadata-special-files

Conversation

@gaborbernat

@gaborbernat gaborbernat commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Reseeding could block on package metadata, delete files outside the environment or overwrite unrelated launchers. The app-data seeder now checks cleanup targets against the environment and waits for active installs after the first Ctrl+C. The pip seeder updates launchers listed by the selected wheels. Previous cleanup, previous install scheduling.

Reseeding and cleanup

The app-data seeder reads RECORD and top_level.txt from regular files. It checks each listed path against the environment before lookup, then verifies the resolved deletion target. On Windows it removes a junction itself and processes directories carrying cloud placeholder tags as ordinary directories. The app-data seeder builds images concurrently and installs them one at a time. A separate process can still change the destination between the check and deletion. Metadata cleanup, install scheduling.

Ctrl+C cancels queued work, so the environment may be missing seed packages. The seeder waits for active workers before removing temporary app-data. A second Ctrl+C exits the CLI immediately, even if a worker is stuck, and can leave a staging directory or temporary app-data behind. Rerun creation to rebuild the staged image and finish installing packages. virtualenv.cli_run waits for active workers before returning control to Python callers. Interrupt handling.

Generated launchers

Both seeders use the interpreter's filesystem path bytes when encoding the path as UTF-8 would produce different bytes under a legacy POSIX locale. Paths containing shell quoting syntax get a shell wrapper. The pip seeder matches the complete generated header before rewriting a selected wheel's launcher. These changes apply during seeding. Launcher generation, wheel launcher selection.

Fixes #3624. Fixes #3625. Fixes #3627. Fixes #3632. Fixes #3636.

Draft advisories: ANT-2026-0QH3KBIN, ANT-2026-2DOJ5V6M, ANT-2026-3YPDYV5C. Reported by oss-scanner: ANT-2026-02O7K288, ANT-2026-0QH3KBIN, ANT-2026-2DOJ5V6M, ANT-2026-3YPDYV5C, ANT-2026-5PAH96SM, ANT-2026-7ZNZMO8Q, ANT-2026-GY26H3A6, ANT-2026-NU6BEMWZ.

@gaborbernat
gaborbernat force-pushed the fix/3627-seed-metadata-special-files branch from 0e572d2 to 6bff961 Compare November 20, 2026 15:09
@gaborbernat gaborbernat changed the title 🐛 fix(seed): skip special metadata on reseed 🐛 fix(seed): contain reseeding and launcher paths Nov 20, 2026
@gaborbernat gaborbernat added the security Fixes a vulnerability or hardens the supply chain, CI or release label Nov 20, 2026
gaborbernat and others added 3 commits November 20, 2026 07:29
Wait for running seed workers before cleanup and report failures to the caller. Validate metadata as it is read, keep cleanup within the environment, and update launchers using their selected wheel records.
The Windows path mock changed the shared POSIX parser at import time, so
later tests treated backslashes as separators. Restore the parser after
each mocked test. Wait for the seed worker to start before injecting
interrupts so the test checks active-work cleanup.

Restore explicit Final types required by the updated lint gate.
@gaborbernat
gaborbernat force-pushed the fix/3627-seed-metadata-special-files branch from 2b4fd7d to f5d6dbd Compare November 20, 2026 15:41
Python 3.9's Path subclass requires an explicit flavour attribute. Keep
it on the mock while restoring the shared parser after each test.
@gaborbernat
gaborbernat marked this pull request as ready for review November 20, 2026 18:16
@gaborbernat
gaborbernat marked this pull request as draft November 20, 2026 20:26
Let the CLI stop even when a worker is blocked in an image build. A normal
exit would join the worker again during executor and interpreter shutdown.
Python callers keep waiting for active workers before temporary cache cleanup.

Make cancellation retryable when an interrupt lands before a queued worker
signals completion.

Refs pypa#3627
@gaborbernat
gaborbernat marked this pull request as ready for review November 20, 2026 21:41
@gaborbernat
gaborbernat merged commit 1675d1e into pypa:main Nov 20, 2026
82 checks passed
@gaborbernat
gaborbernat deleted the fix/3627-seed-metadata-special-files branch November 23, 2026 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug documentation security Fixes a vulnerability or hardens the supply chain, CI or release

Projects

None yet

1 participant