Preserve clean EOF after non-blocking gzip member - #1293
Open
carrerasdarren-cell wants to merge 1 commit into
Open
Preserve clean EOF after non-blocking gzip member#1293carrerasdarren-cell wants to merge 1 commit into
carrerasdarren-cell wants to merge 1 commit into
Conversation
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
reader
EAGAINRoot cause
After
Z_STREAM_END,gz_look()immediately switched fromLOOKtoGZIPwhen no compressed input was buffered. On a non-blocking descriptor, an
EAGAINafter the completed trailer therefore committed the state machine toa next member that might never arrive. If EOF appeared on a later call, the
empty next member was reported as truncated.
The complete uncompressed payload was returned, but
gzclose()returnedZ_BUF_ERROR. The regression reproduces this with public APIs and a localpipe: it feeds one valid member one byte at a time, drains to
EAGAINaftereach byte, and closes the writer only after the trailer has been consumed.
The fix asks
gz_avail()for input while still inLOOK. AnEAGAINleavesthe reader ready for a delayed concatenated member, while a later EOF with no
bytes is clean.
This is distinct from the open non-blocking write-side reports and patches in
#1256,#1281,#1286, and#1292.Validation
developwithgzclose returned -5 after a complete streammake testpass-Wall -Wextra -Werrorbuild and test passtransparent reads, trailing garbage handling, and
Z_BUF_ERRORfor a trulytruncated trailer