gzip · shipping · also GZIP, .gz

Gzip

Gzip is a lossless compressed-file format whose file consists of a sequence of members, each carrying a compressed data stream and a trailer with CRC32 and uncompressed size modulo 2^32.

Related Observatory article: Gzip on hesela.com

A member is a compression-format unit, not necessarily a named TAR entry or the full intended recovery object. RFC 1952 defines the format; a surviving valid member cannot reveal that a different complete member was removed. [1]

Python gzip.decompress supports concatenated members. In contrast, zlib's inflate interface stops at a member boundary; callers must continue with the remaining input when multiple members are intended. Python's object API exposes eof and unused_data for different questions: terminal state and bytes after that stream. [2] [3] [5]

In Hesela's 42 bounded operations on CPython 3.12.3 and zlib 1.3, reading exactly 65,536 expected bytes then closing returned correct bytes without an error from a gzip whose CRC was deliberately damaged. Reading through EOF detected the discrepancy after returning the same payload. Removing one final trailer byte likewise escaped the exact-length read; decompressobj plus flush returned all bytes but left eof false. These are observations at recorded call sizes, not guarantees of error timing. [6]

On an intact two-member input, the single-member zlib call returned 65,536 of the required 98,304 bytes without an exception. Removing the second member entirely let whole-input gzip decoding succeed, but failed the separately fixed full-payload comparison. Require intended decoding coverage, terminal status and independent content expectations. A successful read or close alone is not whole-archive verification. [6]

Relations

related
archive-member, backup-manifest, checksum, zstandard, restore-test

Citations

  1. RFC 1952: GZIP file format specification 4.3, sections 2.2, 2.3.1 and 2.3.1.2 (accessed 2026-10-18)
  2. Python 3.12 gzip documentation: multi-member decompression and errors (accessed 2026-10-18)
  3. Python 3.12 zlib documentation: eof, unused_data and unconsumed_tail (accessed 2026-10-18)
  4. zlib v1.3 public interface: inflate stops at a gzip member boundary (accessed 2026-10-18)
  5. Hesela: 42 gzip API operations distinguish trailer checks, member completion and expected content (accessed 2026-10-18)

Further reading

  1. CPython v3.12.3 gzip.py: GzipFile.close and _GzipReader._read_eof (accessed 2026-10-18)
Sources & caveats

JSON: /data/terms/gzip.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. Gzip. Hesela. 2026-10-18. https://hesela.dev/terms/gzip/