Fix sdist extraction on older Python versions - #11037
Open
fredrikblau wants to merge 4 commits into
Open
Conversation
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. If the owner-name workaround is wrong, extraction could fail or create files with an unintended owner or group, potentially affecting access to the extracted sdist. Reverting fixes future extractions, but already-created files and their ownership would remain until the archive is re-extracted or the metadata is corrected.
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
fredrikblau
force-pushed
the
fix/older-python-sdist-extraction
branch
from
August 31, 2026 13:02
907013b to
f89bbd6
Compare
radoering
requested changes
Aug 31, 2026
radoering
left a comment
Member
There was a problem hiding this comment.
There are more spots with the pattern "try - except KeyError" and running the repro with Poetry from your branch still fails:
TypeError
uid should be integer, not NoneType
(Just replace poetry==2.4.2 with git+https://github.com/fredrikblau/poetry.git@fix/older-python-sdist-extraction in the repro.)
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.
Summary
The tar security fallback clears ownership names with
None. Python versions before 3.10.12 and 3.11.4 pass those values togrp.getgrnam()/pwd.getpwnam(), causing root sdist installs to fail.Use empty ownership names instead, which preserves the ownership-stripping behavior without triggering the older tarfile bug. Added a regression test that simulates the affected tarfile implementation.
Fixes #11036.
Tests
pytest tests/utils/test_helpers.py -q(50 passed)pytest(2,935 passed, 28 skipped; 6 collection errors due missingdeepdiffbefore installation, and one unrelated Python 3.14 platform-tag expectation)ruff check tests/utils/test_helpers.py(passed; existingPLC0206remains insrc/poetry/utils/helpers.py)