Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-108111: Flush gzip write buffer before seeking, fixing bad writes #108341

Merged
merged 5 commits into from
Aug 24, 2023

Conversation

effigies
Copy link
Contributor

@effigies effigies commented Aug 22, 2023

Issue described in detail in #108111.

Short story: write(x); seek(len(x)); write(x) results in b''.join([x, bytes(len(x)), x]) being written. This is due to buffered writes not updating the GzipFile.offset() until flushed. It's possible there could be something more efficient, but this seemed like the simplest solution.

@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Aug 22, 2023

All commit authors signed the Contributor License Agreement.
CLA signed

@encukou encukou self-requested a review August 23, 2023 14:52
@encukou encukou added the needs backport to 3.12 bug and security fixes label Aug 23, 2023
@ambv ambv merged commit 2eb60c1 into python:main Aug 24, 2023
@miss-islington
Copy link
Contributor

Thanks @effigies for the PR, and @ambv for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-108402 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label Aug 24, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Aug 24, 2023
…rites (pythonGH-108341)

(cherry picked from commit 2eb60c1)

Co-authored-by: Chris Markiewicz <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
Yhg1s pushed a commit that referenced this pull request Aug 24, 2023
…writes (GH-108341) (#108402)

gh-108111: Flush gzip write buffer before seeking, fixing bad writes (GH-108341)
(cherry picked from commit 2eb60c1)

Co-authored-by: Chris Markiewicz <[email protected]>
Co-authored-by: Łukasz Langa <[email protected]>
@effigies effigies deleted the fix/gzip-writeseekwrite branch August 24, 2023 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants