Repository navigation
fix: preserve existing stream positions when appending - #20
Open
jovial-liu wants to merge 1 commit into
Open
jovial-liu wants to merge 1 commit into
jovial-liu wants to merge 1 commit into
Conversation
Owner
|
Hello and thank you for the PR!
Although it has been almost 5 years since I implemented this, I think I did it on purpose, because I did not see any reason why keeping the existing padding. I am not against it, but would like some justification of why this change is needed or better than before. |
This branch has not been deployed
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.
Adding a new stream to an existing nonempty archive opened in
r+can overwrite an existing stream when the input contains padding or empty streams. For example, an archive with 64 bytes of internal padding and 8 trailing padding bytes originally decodes both payloads, but adding a third stream can leave only the first and third payloads even though native XZ reports success. Padding between or after streams is permitted by the XZ file format.Place the new stream after the last retained stream's actual file region, rather than summing compressed stream lengths. Regression tests cover internal and trailing padding, empty streams, repeated stream changes, file and BytesIO storage, and appending after truncating the last stream.
Validation on macOS with Python 3.12.14:
tox run -e py,build,generate-integration-files,lint,typepasses: 627 tests pass, 16 skip, coverage remains 100%; both distributions build; all 13 native fixture-generation cases, Ruff, and both mypy checks pass.AI-assisted with OpenAI Codex; independently reviewed before submission.