compress/gzip: multistream reading fails on os.File #30230
Labels
FrozenDueToAge
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
While implementing a multi-stream gzip reader for a specific bioinformatics file format (BAM),
(*gzip.Reader).Reset(*os.File)
fails to reset the stream correctly. It appears to be due to read-ahead somewhere, as substitutingos.File
with abytes.Buffer
with the same contents works correctly.I've attached a somewhat minimal example code and a truncated data file to give a test case showing the above (attached). The data files are typically in the multi-gigabyte range so streaming from disk is preferred to loading everything into memory.
bug_repro.zip
What did you expect to see?
Loading from a file should work the same as loading from a buffer.
What did you see instead?
The file is advanced too far, so the subsequent read fails to find the header of the next gzip chunk.
The text was updated successfully, but these errors were encountered: