Repository navigation
Conversation
… zstd In stream mode the bz2, xz and zstd decompressors were fed again after reaching the end of their data, which raised a bare EOFError. Stop reading once the decompressor reports eof, as the code did before it was rewritten. Add stream-mode tests for concatenated archives with ignore_zeros and for an archive without end-of-archive blocks.
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.
closes #159643
In stream mode (
r|bz2,r|xz,r|zst, andr|*when it detects one of them),_Stream._readcalleddecompress(b"")on a decompressor that had already reached the end of its data, because an exhaustedBZ2Decompressor,LZMADecompressororZstdDecompressorreportsneeds_inputas false. That raised a bareEOFErrorwhenever tarfile read past the end of the compressed stream, for example withignore_zeros=Trueor on an archive without end-of-archive blocks.This change stops the read loop once the decompressor reports
eof, which matches what the code did before the gh-121109 rewrite. The gzip branch is unchanged.The new tests in
StreamReadTest(run for plain, gzip, bz2, xz and zstd streams) read two concatenated archives withignore_zeros=Trueand an archive that has no end-of-archive blocks, and check that the expected member names come back. Both fail withEOFErrorfor bz2, xz and zstd without the fix.