Detect compressed tar archives during extraction - #193
Open
Gonghan-Princess wants to merge 2 commits into
Open
Gonghan-Princess wants to merge 2 commits into
Gonghan-Princess wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #193 +/- ##
=======================================
Coverage 98.48% 98.48%
=======================================
Files 13 13
Lines 793 793
=======================================
Hits 781 781
Misses 12 12
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Describe your changes
create_tar_file(..., compression="gz"/"bz2"/"xz")produces archives thatextract_tar_file()currently rejects withtarfile.ReadError. Open archives throughtarfile.open(..., "r:*")so extraction detects compression from the archive content.Parameterize the existing extraction and autodelete tests over plain tar, gzip, bzip2, and xz, and cover extracting selected members for each format. The tests deliberately use a
.tarfilename for every format so detection is independent of the extension.Validation on Windows / Python 3.12.10:
The other CI operating systems and Python 3.10/3.11/3.13/3.14 were not run locally. Existing extraction-filter handling and delete-after-success behavior are unchanged.
Related issue
No existing issue identified; this was reproduced by round-tripping archives through the public creation and extraction functions.
Checklist before requesting a review
AI disclosure: OpenAI Codex prepared the fix and tests and performed an independent agent review and verification. The self-review checkbox refers to that AI review; no human review is claimed. No third-party source code was copied.
CI follow-up
Codacy reported B101 on the two new pytest assertions in the selected-member regression test. Add narrowly scoped
# nosec B101annotations with a test-only explanation. The assertions and Python AST are unchanged. Bandit 1.9.4 confirms exactly those two findings disappear; all 34 pre-existing findings in that test file remain. The 16 archive tests and all configured pre-commit hooks (including Ruff and mypy) pass after the annotations.Scrutinizer reports the same analysis/setup error on the unchanged base commit, before this PR: base inspection. Its underlying log could not be accessed, so the exact service error is still unverified. The repository's full local suite passes (175 passed, 3 platform skips, 98.36% coverage); the new commit now passes all 15 GitHub Actions OS/Python matrix jobs, Codacy, and both Codecov checks (18 successful checks total). Scrutinizer still reports its pre-existing analysis/setup error.