Research notes / Archive recoverability
Compressed archives: intact bytes can still be unreadable
Published / Updated / Designed recovery experiments
A restore must recover the intended content, finish every required decoder and member check, and propagate validation failures. Matching length or exit status alone cannot establish this. Our bounded Zstandard, TAR, gzip, ZIP, XZ and CPIO experiments isolate missing dependencies, duplicate names, incomplete reads and misleading success signals. The tables below distinguish format rules from observations on specific software builds.
On this page40 sections
What a lossless round trip preserves
Lossless compression reconstructs the encoder's input exactly. For the byte-oriented formats discussed here, decoding must recover the same byte sequence, not merely the same length or readable text. The promise starts at the encoder input: discarding file metadata before compression cannot make that metadata recoverable. [RFC 8878, section 2]
Exact recovery does not require a unique compressed representation. Different encoding choices can produce different compressed bytes that decode to the same payload. It also does not promise a smaller file: no lossless compressor can shrink every possible input. Keep the data-reduction ratio and its measured storage footprint separate from the codec's reversibility. [RFC 1951, sections 1.1 and 4]
Why every file cannot get smaller
Fix the decoder and all external context. There are 65,536 possible two-octet inputs, but only 257 shorter octet strings: the empty string and 256 one-octet strings. Exact recovery requires distinct inputs to have distinct encodings, so at most 257 inputs can become shorter and at least 65,279 cannot. We generously allow a known object boundary and ignore framing cost. A format that forbids empty outputs or needs headers can do worse. [RFC 1951, section 1.1]
This is exact counting over all two-octet strings, not a measured workload or a prediction for ordinary files. The executable calculation uses (256n - 1) / 255 shorter strings for n input octets. Dictionaries or identifiers that vary per object must be included in the representation; otherwise information has merely moved elsewhere. Shannon's source-coding theorem addresses average rates for a specified source, not savings on every file. [Shannon, sections 9-10]
The remaining recovery obligations are separate. A frame may need an external dictionary; an optional checksum may not be checked. The verification controls below examine those conditions. Byte-preserving compression is a format property, not evidence that a particular damaged archive was fully validated. [RFC 8878, sections 3 and 3.1.1.1.3]
A short run still needs decoding context
Run-length encoding replaces a repeated value sequence with a compact description. In a Zstandard RLE block, one content byte expands to the count in Block_Size; the three-byte block header and frame overhead remain separate. A decoder must check the permitted output size before expansion. [RFC 8878, section 3.1.1.2]
Bit packing instead places values into bit fields. Arrow uses it for Boolean values and validity flags, while buffer padding and alignment still contribute to memory use. Payload bits are not allocated bytes. [Arrow layout]
| Values | Packed run | Repeated run |
|---|---|---|
| 0 through 7 | 03 88 c6 fa | Not one repeated run |
| Eight copies of 5 | 03 6d db b6 | 10 05 |
Parquet's hybrid header distinguishes a packed group count from a repetition count. The same repeated input above has two valid representations. Deprecated BIT_PACKED has different ordering; the decoder needs the encoding identifier and width, not just these bytes. [Parquet encodings]
Where the run ends depends on the page
Parquet prefixes level streams with a four-byte encoded length in data page v1, but omits that prefix in v2. Dictionary indices omit it in both versions and carry a bit-width byte instead; RLE Boolean streams retain the length prefix in both. A parser must select the enclosing format before interpreting the first run byte. [Parquet encodings, length-prefix table]
Packed values also need their schema meaning. Dremel's nested-column design uses repetition levels to locate repeated structure and definition levels to distinguish absent ancestors from present values. A decoded sequence of integers alone cannot reconstruct those records. The paper's record-assembly algorithm consumes levels and values together; it is not the Parquet wire specification. [Melnik et al., sections 4.1-4.3]
The bounded arithmetic example and regression tests cover unsigned fields and run headers, not complete Parquet pages, checksums or corruption rates. This is a format illustration; its short fragments are not independently recoverable archives.
A shared base shrinks offsets; outliers widen the block
Frame-of-reference encoding stores offsets from a shared base, often a block minimum. This differs from subtracting the previous value. In Parquet's DELTA_BINARY_PACKED encoding, the two transformations are composed: first adjacent differences, then subtraction of the block's minimum difference, then bit packing per miniblock. [Parquet specification]
| Input | Offset | Width | Bits |
|---|---|---|---|
| Clustered values 1000, 1001, 1003, 1007 | 0, 1, 3, 7 | 3 | 12 |
| Append one outlier 1000, 1001, 1003, 1007, 2024 | 0, 1, 3, 7, 1024 | 11 | 55 |
Four clustered values need 12 offset bits. Appending one outlier raises the maximum offset to 1024, so all five fixed-width fields now need 11 bits each: 55 payload bits. A constant block can instead use zero offset bits if its base and count are retained. These are payload calculations, not stored-file sizes.
Keep exceptions separate, but count their cost
Patched frame-of-reference schemes select a packed width and preserve exceptional values separately. An unsigned value at or above 2^b does not fit b bits. Exception locations and data have a cost, so the narrowest main stream need not give the smallest complete representation. PFOR, NewPFD and FastPFOR use different layouts and width-selection rules. [Lemire and Boytsov, sections 2.6-2.8 and 5]
The original PFOR design can also choose a base above some inputs and store those below-base values as exceptions. PFOR-DELTA adds adjacent differencing before PFOR; it is a specific composition, not another name for every patched scheme. [Zukowski et al., section 3.1]
In our illustrative low/high split at width 3, the five low fields are 0, 1, 3, 7, 0. The last offset needs an exception at zero-based position 4 with high part 128: 128 * 8 + 0 = 1024. There are 15 low-field bits, plus the exception and metadata. This toy representation does not specify a PFOR wire format or show net space savings.
Preserve the reference and layout. Plain FOR reconstruction uses base + offset without a prefix sum once the block is located. That does not promise constant-time access through an entire file. Changing the base from 1000 to 2000 in the first example produces 2000, 2001, 2003, 2007 with unchanged offsets and width; valid reconstruction arithmetic is not an integrity check.
Overflow is part of the format. Parquet specifies two's-complement wraparound at the physical integer width for both subtraction and reconstruction. For a 64-bit transition from 2^63 - 1 to -2^63, the wrapped adjacent delta is 1; the unbounded mathematical difference is 1 - 2^64. Rejecting that signed overflow would reject a valid transition. [Parquet specification]
Parquet additionally requires the first value, counts, block geometry, minimum deltas and miniblock widths; its integer differences use the specified fixed-width overflow rules. Our exact arithmetic model and regression tests use mathematical BigInt offsets with signed-64-bit inputs, not a Parquet decoder or a benchmark.
DEFLATE block boundaries do not guarantee independent recovery
LZ77 names a copying approach, not a decoder input format. DEFLATE adds Huffman coding to history references; LZ4 blocks use byte-oriented tokens without an entropy-coding backend. Their backward-distance limits also differ: 32768 bytes for DEFLATE, 65535 for LZ4. Neither limit caps the total file size. A shared algorithmic family does not make compressed streams interchangeable. [RFC 1951] [LZ4 block specification]
The DEFLATE limit describes permitted streams, not how exhaustively a compressor searches. RFC 1951 allows a conforming compressor to use a smaller window or limit its search effort; a compliant decompressor must accept the full defined range. Compression settings can therefore change size and speed without changing the file format. Do not infer a particular encoder's search policy from the 32768-byte format limit. [RFC 1951, sections 3.3-4]
LZ4 blocks additionally require enclosing metadata, such as input size and an output bound, that the block format does not carry. Zstandard supplies its own frame, sequence and dictionary rules. For long-term recovery, record the concrete format and preserve required dictionary or history state; an LZ77 label alone is insufficient. [LZ4 metadata] [Zstandard specification]
DEFLATE and its wrappers are different layers. Raw DEFLATE supplies the encoded blocks; zlib and gzip add framing and payload checks. Selecting the wrong decoder mode is not evidence of damaged storage. [RFC 1950] [RFC 1952]
| Input format | Payload check | Framing distinction |
|---|---|---|
| Raw DEFLATE | No wrapper checksum | Encoded blocks only |
| zlib | Adler-32 | Header; optional preset-dictionary identifier |
| gzip | CRC32 | Member header; size modulo 2^32 in trailer |
Fixed or dynamic Huffman coding is local to a compressed block, but backward references can use earlier blocks. The 32768-byte distance limit is not a stream-size limit. Stored blocks allow at most 65535 data bytes; compressed blocks have no equivalent size cap. A block offset alone is therefore insufficient for random access when decoding requires earlier history. [RFC 1951, sections 2 and 3.2-3.3]
A match may also overlap its own output. After XY, length 5 at distance 2 appends XYXYX: each newly emitted byte can become history for the same match. A decoder starting at that block without the required history cannot reconstruct the intended bytes. [RFC 1951, section 3.2.3]
The underlying copying idea predates DEFLATE. Ziv and Lempel's 1977 paper describes reconstructing segments from a recent-output buffer and identifies error propagation as a drawback. Its theoretical compression bounds are not a measured recovery rate for modern archives. [Ziv and Lempel, introduction]
Checksum presence and enforcement are separate. RFC 1950 requires a zlib decoder to check Adler-32; RFC 1952 allows a compliant gzip decoder to skip trailer checks. For recovery, select and finish a reader that actually validates the required trailer rather than inferring validation from the format name. [RFC 1950, section 2.3] [RFC 1952, section 2.3.1.2]
Keep block boundaries, wrapper completion and archive coverage separate. The gzip completion controls below test caller behavior; they do not turn a raw decoder into a checksum validator. This comparison is source synthesis, not a new codec experiment.
Recover the dictionary and the format conventions
LZ78 builds phrases from an earlier phrase plus an extension symbol. Its final phrase can be incomplete. LZW starts with single-symbol strings and lets the decoder reconstruct new dictionary entries from the code sequence. Neither algorithm name identifies every convention needed to read a stored file. [Ziv and Lempel, 1978] [Welch, 1984]
| Recovery rule | GIF89a | TIFF 6.0 |
|---|---|---|
| Code packing | Least-significant-bit first | High-to-low, independent of TIFF byte order |
| Width transitions | GIF growth convention; at most 12 bits | Earlier growth convention; at most 12 bits |
| Reset boundary | Clear resets the table; a full table may remain frozen | Each strip starts with Clear and is compressed independently |
| Completion | End of Information plus a separate data-sub-block terminator | Each compressed strip ends with End of Information |
Changing bit order alone does not convert a GIF LZW decoder into a TIFF one. Preserve the format version, code-width transitions, restart boundaries and any preprocessing metadata. TIFF's optional horizontal differencing predictor must be reversed separately after LZW decoding. [GIF89a] [TIFF 6.0, sections 13-14]
A reconstructed dictionary need not be a separately archived file, unlike the external dictionary dependencies below. It is still decoder state: an arbitrary compressed offset is not automatically a restart point. This comparison is a source synthesis, not a native decoder test.
A probability model is part of the decoding contract
Entropy coding targets expected length under a model, not a smaller result for every file. Shannon's limit is an average for a specified stochastic source; a byte histogram ignores ordering and longer dependencies. [Shannon 1948, section 9]
Arithmetic coding narrows an interval for each symbol. The decoder needs the same model and a stopping rule. Practical formats also specify integer precision, renormalization and finalization; RFC 6716 describes one range coder, not a universal compressed-file format. [Witten et al. 1987, pp. 520-523] [RFC 6716, sections 4.1 and 5.1.5]
Exact teaching example: fix ordered probabilities A=3/4 and B=1/4, and supply length two externally. Choose the shortest binary-prefix cell fully inside each final interval. These are synthetic calculations, not Opus output or a benchmark.
| Message | Final interval | Enclosed binary cell | Prefix | Bits | Packed bytes |
|---|---|---|---|---|---|
| AA | [0, 9/16) | [0, 1/2) | 0 | 1 | 1 |
| AB | [9/16, 3/4) | [5/8, 3/4) | 101 | 3 | 1 |
| BA | [3/4, 15/16) | [3/4, 7/8) | 110 | 3 | 1 |
| BB | [15/16, 1) | [15/16, 1) | 1111 | 4 | 1 |
AA uses one payload bit, but AB needs three, compared with two fixed-width bits each. The four-message model-weighted mean is 31/16 bits, below two, while every separately byte-packed result still occupies one byte before the excluded costs. Encoding a longer joint stream is a different accounting boundary.
Model agreement matters independently of size: tag 5/8 decodes to AB for two symbols under this model, but to BB if the decoder swaps the probabilities. A valid arithmetic interval does not authenticate the model or the recovered message.
Reproduce the exact worksheet with the Python model, regression tests and machine-readable results. The model uses rational arithmetic and a declared binary-cell rule; it does not simulate finite-precision codec overhead.
Count symbols, not just phrases
Tunstall coding takes the opposite direction from symbol-wise Huffman coding: variable-length source phrases become fixed-width indices. For a known memoryless source and fixed index width, the classical construction maximizes expected phrase length. This is a model-specific objective, not a universal file-size optimum. [Drmota et al. 2006, sections I-II]
With the same A=3/4, B=1/4 model, use the four phrases AAA, AAB, AB and B. A constructed, not observed population containing 27, 9, 12 and 16 copies respectively has 64 phrases and 148 source symbols. Two-bit indices cost 128 payload bits: 32/37 bit per source symbol. Equivalently, divide 2 by the expected phrase length 37/16.
Averaging each phrase's own bits-per-symbol ratio using phrase probabilities gives 17/16. That is a valid phrase-weighted statistic, but not the aggregate coding rate: longer phrases contribute more source symbols. Binary symbol-wise Huffman uses one bit per symbol here; Huffman over blocks is a different comparison. The Tunstall and symbol-wise Huffman payload rates both exclude dictionary and framing costs.
The ending also matters: AA is not a complete phrase in this dictionary. A finite-file format must specify how to finish and recover that tail. The exact worksheet includes both denominators and the constructed counts; the Tunstall construction example covers dictionary generation and tail controls. No measured codec ranking follows from these calculations.
Prefix decoding is not an integrity check
Huffman coding optimizes codeword lengths for symbol frequencies. Canonical DEFLATE tables can be reconstructed from ordered code lengths, but decoding also needs block framing and length/distance semantics. A correct table is only one recovery dependency. [RFC 1951, sections 3.2.1-3.2.3]
Huffman's original construction repeatedly combines the two least likely messages. Its optimum is the smallest expected codeword length for the given probabilities under a prefix-code model and equal cost per coding digit. It is not a guarantee about every message, header cost or the smallest possible archive. Equal-probability choices can produce different optimal codes. [Huffman 1952, pp. 1098-1100]
Exact illustration: use A=0, B=10, C=110 and D=111. Eight A symbols, four B symbols, two C symbols and two D symbols take 28 payload bits, versus 32 for two-bit fixed-width symbols. Codebook and framing costs are excluded, so this is not a file-size saving claim.
The same codebook turns ABCD into 010110111. Changing its last bit gives 010110110, which still decodes completely, but to ABCC. Four valid symbols and unchanged length do not establish the intended content. This is a constructed counterexample, not a native decoder test or corruption-rate estimate. Compare with the separate wrapper checks.
Lengths need a mapping: swap C=110 and D=111 while keeping A and B unchanged. The lengths remain 1, 2, 3, 3 and the weighted cost stays 28 bits, but the unchanged 010110111 now decodes to ABDC. Canonical reconstruction removes this ambiguity only with the specified symbol order and assignment rules. Retain those rules with the lengths. [RFC 1951, section 3.2.2]
What codeword lengths can and cannot prove
A prefix-free code lets a decoder recognize a symbol as soon as its codeword ends, given the same codebook and a known starting boundary. Prefix freedom is sufficient for unique decoding, but not necessary. It does not by itself promise recovery of alignment after a lost bit. [Huffman 1952, pp. 1098-1099] [McMillan 1956]
For binary uniquely decodable codes, the Kraft sum sum(2^-length) is at most one. Conversely, lengths satisfying that bound admit a prefix-free assignment. The converse is an existence result, not validation of an arbitrary map. Both constructed maps below have lengths 1, 2, 2 and sum 1/2 + 1/4 + 1/4 = 1, but only the first is prefix-free. [McMillan 1956]
| Assignment | A / B / C | Prefix-free? | Complete parses of 010 |
|---|---|---|---|
| Prefix-free assignment | 0 / 10 / 11 | Yes | AB |
| Ambiguous assignment | 0 / 01 / 10 | No | AC or BA |
In the second map, 0 | 10 is AC while 01 | 0 is BA. Checking only lengths or the Kraft sum accepts both maps and misses this ambiguity. DEFLATE avoids arbitrary assignment by specifying canonical reconstruction rules and symbol order; those conventions remain part of its decoding contract. [RFC 1951, section 3.2.2]
The table is generated from a bounded executable example with regression tests, not a general unique-decodability algorithm or a native codec experiment. Framing and integrity checks remain separate requirements.
Unique finite decoding can still require waiting
A uniquely decodable code gives each complete encoded finite message just one source-symbol sequence. This is weaker than prefix freedom: the codewords 0, 01, 11 are not prefix-free but are suffix-free, so a complete message can be parsed uniquely backwards. [Falucskai 2011] [Cassaigne and Nicolas, section 1.1]
| Codebook | Codewords | Prefix-free? | Uniquely decodable? |
|---|---|---|---|
| Prefix-free | 0 / 10 / 11 | Yes | Yes |
| Nonprefix, uniquely decodable | 0 / 01 / 11 | No | Yes |
| Ambiguous | 0 / 01 / 10 | No | No |
Delay is separate. With the middle codebook, 0 | 11 | 11 | ... and 01 | 11 | 11 | ... share arbitrarily long bit prefixes but begin with different symbols. Finite-message uniqueness therefore does not promise a uniform left-to-right decision bound. The displayed repeating patterns are a constructed argument, not infinite messages accepted by a file format.
Test the codebook, not a short sample. Sardinas-Patterson follows unmatched codeword suffixes; reaching the empty suffix proves ambiguity, while closing their finite reachability search without it proves uniqueness. Our bounded exact checker generates the table and throws if its resource budget runs out. Its tests include 0, 0010, 1001: no collision below ten bits, then 0 | 0 | 1001 | 0010 = 0010 | 0 | 1001 | 0. Short successful round trips alone would miss that ambiguity. [Falucskai 2008, section 1]
These are finite mathematical examples, not a codec benchmark. Neither a unique parse nor a terminating codebook test verifies intended content, file completeness or recovery after lost framing.
Rice parameters change the bit budget
Golomb-Rice coding splits an unsigned value u into quotient floor(u/2^k) and k remainder bits. FLAC writes that many zero bits, a one-bit terminator, then the remainder. It first maps signed residual x to 2x when nonnegative, or -2x-1 otherwise. [RFC 9639, section 9.2.7]
| Parameter k | Payload bits |
|---|---|
| 0 | 46 |
| 1 | 31 |
| 2 | 26 |
| 3 | 27 |
| 4 | 31 |
Among these candidates, k=2 is smallest. Larger k shortens the unary quotient but lengthens every remainder. FLAC selects parameters per partition and reserves all-ones parameter fields for fixed-width escape coding. These choices and partition geometry belong to the format, not this payload-only calculation. [RFC 9639, sections 9.2.7.1-9.2.7.3]
Reproduce the exact calculations with the accompanying tests: node --test huffman-rice.test.mjs. The model uses exact integers, rejects invalid inputs and tests all four-symbol strings through length six. It constructs neither a DEFLATE stream nor a FLAC file; the separate FLAC experiments test actual reader behavior.
Entropy tables are recovery dependencies too
Asymmetric numeral systems (ANS) encode symbols into a state. Ordinary decoding removes them in the opposite order. Zstandard's Finite State Entropy (FSE) uses this family of ideas; rANS arithmetic is not its wire format. [Duda, sections 2.3 and 4]
Do not reverse an entire compressed block. FSE symbol bitstreams are read backward, while probability-table descriptions are read forward. The applicable table and initial state are both needed. [RFC 8878, sections 4.1-4.1.1]
| Mode | Where decoding information comes from |
|---|---|
| Predefined | A format-defined distribution |
| RLE | One symbol supplied for that code type |
| FSE compressed | A distribution described in this block |
| Repeat | The applicable earlier sequence table, or a dictionary table |
Repeat mode without an earlier table in the same frame or a dictionary-provided table is corruption. Zero-sequence blocks do not replace sequence tables; repetition can also retain a predefined or RLE table. Reusing a table does not reuse the previous block's final decoding state. [Zstandard v1.5.7, sequence header and bitstream]
A small reversible-state check
Our exact-integer illustration assigns frequencies A=3 and B=1. Starting at state 4, pushing AAB yields states 5, 6, 27. Three pops return BAA and recover state 4. Encode the input in reverse to obtain forward decoding. This checks the rANS transition equations; it omits renormalization, byte framing and FSE tables. It is not a compression-ratio or speed measurement.
Arithmetic source and exhaustive bounded tests are executable with Node. A recoverable block needs its decoding context, not just an offset. See random-access verification for the separate index and checksum experiment.
A dictionary ID is not a dictionary
Zstandard permits independent frames and optional external dictionaries. The dictionary bytes are supplied separately; a frame's dictionary identifier does not contain them. That identifier can also be absent, so its absence does not prove the frame is self-contained. The optional content checksum stores the low 32 bits of XXH64 over decoded data. It is not an archive inventory or cryptographic authentication. [RFC 8878]
The CLI exposes dictionary selection through -D, checksum selection through --check and --no-check, and identifier omission through --no-dictID. We deliberately exercise those switches below. Defaults and options should be recorded, not inferred from a filename. [Zstandard CLI]
For block-level framing, see LZ4 block order and completion checks: twelve API cases distinguish intact blocks, declared length, content order and a finished frame.
For already damaged files, the bzip2 block-recovery experiment shows which fragments pass validation and why a damaged delimiter can affect two candidate blocks. Partial salvage needs an explicit record of gaps.
Fourteen cases: what did the check cover?
Our dictionary is 8,192 deterministic synthetic bytes. The 2,048-byte test payload is a slice of that dictionary, intentionally making dictionary dependence strong. The wrong dictionary inverts every bit without changing its length. These are raw-content dictionaries, not trained dictionaries with embedded identifiers. The harness checks that the produced frames omit a dictionary ID.
| Case | Decoder checksum policy | Exit code | Output / expected bytes | Exact match | Payload accepted |
|---|---|---|---|---|---|
| No dictionary required | Verify if present | 0 | 2048 / 2048 | Yes | Yes |
| Correct raw dictionary; checksum | Verify if present | 0 | 2048 / 2048 | Yes | Yes |
| Missing raw dictionary; checksum | Verify if present | 1 | 0 / 2048 | No | No |
| Wrong raw dictionary; checksum | Verify if present | 1 | 0 / 2048 | No | No |
| Wrong raw dictionary; no checksum | Verify if present | 0 | 2048 / 2048 | No | No |
| Correct raw dictionary; no checksum | Verify if present | 0 | 2048 / 2048 | Yes | Yes |
| Both complete frames | Verify if present | 0 | 22 / 22 | Yes | Yes |
| Entire second frame removed | Verify if present | 0 | 11 / 22 | No | No |
| Final byte removed | Verify if present | 1 | 22 / 22 | Yes | No |
| Wrong dictionary; verification disabled | Ignore | 0 | 2048 / 2048 | No | No |
| Damaged checksum; verification enabled | Verify if present | 1 | 0 / 2048 | No | No |
| Damaged checksum; verification disabled | Ignore | 0 | 2048 / 2048 | Yes | Yes |
| Original skippable metadata | Verify if present | 0 | 2048 / 2048 | Yes | Yes |
| Changed skippable metadata | Verify if present | 0 | 2048 / 2048 | Yes | Yes |
Wrong dictionary, successful process: with the checksum absent, the wrong dictionary produced 2,048 bytes and exit code zero, but those bytes differed from the expected payload. Enabling the checksum detected this particular mismatch. This is deliberate misuse, not a newly discovered codec defect or a measurement of checksum collision probability.
Complete frame, incomplete archive: we separately compressed record-one\n and record-two\n, then concatenated the two frames. Removing the second frame left a valid first frame. Decoding succeeded and yielded 11 bytes instead of the intended 22. There was no remaining malformed frame for the decoder to reject. The expected full-stream hash and length exposed the loss.
Complete output, failed process: removing only the final byte from the two-frame stream produced all 22 expected bytes on this build, but the decoder reported premature end and exited with code 1. A pipeline that accepts output while ignoring the producer's status can therefore accept a failed decode. The amount emitted before an error is implementation-dependent; the nonzero status must not be discarded.
The dictionary-free control occupied 2,061 compressed bytes; the dictionary-dependent checked frame occupied 21. That is deliberately contrived reuse, not a compression benchmark. It excludes the 8,192-byte dictionary and says nothing about net savings for a real collection.
Matching dictionary IDs can still return wrong bytes
The earlier cases omit IDs. This separate experiment keeps them: a 2,048-byte formatted dictionary is trained from 128 deterministic synthetic samples with ID 123456. The payload is its final 256 bytes. One variant changes only the ID to 123457; another flips one bit in the dictionary's final content byte while retaining the original ID and entropy tables. These are controlled mutations, not naturally occurring collisions.
| Case | Frame / supplied ID | Exit code | Output / expected bytes | Payload accepted |
|---|---|---|---|---|
| Correct dictionary; checksum | 123456 / 123456 | 0 | 256 / 256 | Yes |
| Missing dictionary | 123456 / None | 1 | 0 / 256 | No |
| Changed ID only; no checksum | 123456 / 123457 | 1 | 0 / 256 | No |
| Changed content; checksum verified | 123456 / 123456 | 1 | 0 / 256 | No |
| Changed content; no checksum | 123456 / 123456 | 0 | 256 / 256 | No |
| Changed content; checksum ignored | 123456 / 123456 | 0 | 256 / 256 | No |
| Correct dictionary; no checksum | 123456 / 123456 | 0 | 256 / 256 | Yes |
| Frame ID omitted; changed dictionary ID only | None / 123457 | 0 | 256 / 256 | Yes |
Different label, unchanged coding data: changing only the dictionary ID caused rejection even though the frame had no content checksum. Omitting the frame ID then allowed that renamed dictionary to decode the same payload correctly. ID comparison and content-checksum comparison are separate checks.
Same label, changed coding data: the one-bit content mutation retained the expected ID, but returned a 256-byte payload differing from the expected bytes with exit zero when the checksum was absent or explicitly ignored. Verifying the checked frame rejected this mismatch. The successful controls used the original dictionary with and without a checksum. We did not find or search for a checksum collision.
The dictionary ID is therefore a selection guard, not a content hash or proof of authenticity. The CLI manual assigns responsibility for locally unique IDs to the dictionary manager; RFC 8878 supplies the format, not a dictionary retrieval protocol. [Zstandard CLI] [RFC 8878]
Rotation must preserve older dependencies
Our engineering inference: keep an immutable mapping from each archive generation to the exact dictionary digest. Do not overwrite a dictionary object in place or reuse its ID while retained archives still depend on it. Test recovery with an empty cache and the retained mapping. A trusted digest detects our changed dictionary; a matching numeric ID alone does not. The digest's trusted association matters as much as its algorithm.
This is a deliberately dictionary-dependent input, not evidence of failure frequency, compression quality or a codec defect. The mutation is confined to generated temporary files. Different readers and versions need their own conformance checks.
When both zlib checksums accept the wrong dictionary
A constructed zlib example produces three wrong bytes in a completed 1,049-byte decode even though the dictionary check and decoded-content checksum both pass. The 45-byte compressed stream stays unchanged. This is a dependency-verification limit, not a new codec defect.
In zlib, DICTID is Adler-32 over the preset dictionary. The trailer checks the decoded content, including any bytes copied from that dictionary; it does not separately hash the dictionary object. The API requires the original dictionary, which a matching checksum alone cannot identify. [RFC 1950] [DEFLATE] [Dictionary API]
What the two Adler-32 sums retain
Adler-32 starts with s1=1 and s2=0. For each byte, it adds the byte to s1, then the updated s1 to s2, reducing both modulo 65521. The result is 65536*s2+s1. The trailer stores this value most-significant byte first. [RFC 1950, section 2.2]
For 00 02 00 and 01 00 01, the final sums are s1=3 and s2=7: both give 0x00070003. The arithmetic and native-zlib checks include a single-byte mismatch control. This small worked example explains the existing dictionary experiment below; it is not a frequency estimate. RFC 1950 requires compliant zlib decoders to check ADLER32 and report a mismatch, but performing the check cannot distinguish these colliding inputs. [RFC 1950, section 2.3]
Unused checksum values are not an error-rate model. For 128 bytes, s1 ranges from 1 to 32641, including its initial 1, and never wraps modulo 65521. RFC 3309 discusses the short-packet distribution problem behind SCTP's historical switch to CRC32C. That protocol decision is not a measured archive-corruption rate. [RFC 3309, section 1]
Conversely, all 65536 two-byte inputs have distinct Adler-32 values: with bytes a and b, s1=1+a+b and s2=2+2*a+b, so a=s2-s1-1 and b=2*s1-s2 recover both. The linked checks enumerate that entire fixed-length domain. The three-byte collision above marks the limit of this example, not a contradiction. Neither output width nor unused values alone determine a probability for the errors your system experiences.
Stone and Partridge's SIGCOMM 2000 study likewise distinguishes error patterns that are always detected from those detected probabilistically, and discusses uncertainty when inferring causes from damaged packets. Its network observations are not an Adler-32 experiment or a storage-fleet estimate. [Stone and Partridge, section 6]
One balanced mutation survives two checks
We changed three adjacent dictionary bytes from 100,100,100 to 101,98,101. Both the byte sum and the weighted sum used by Adler-32 stay unchanged: 1 - 2 + 1 = 0 and w - 2(w-1) + (w-2) = 0. In this fixture, backward references copy those adjacent changes into the payload, preserving its checksum too. Both dictionaries have Adler-32 0x232eee3b; both different outputs have 0xb24bf6ed.
Direct C calls on zlib 1.3 accepted the alternate dictionary with Z_OK and finished with Z_STREAM_END. Python reproduced the result at input chunks of 1, 7 and 65,536 bytes; Node's bundled zlib 1.3.2.1-motley-285e94b reproduced the same frozen input. C and Python share the system library. These are eight designed controls, not independent trials or independent codec implementations.
| Control | Dictionary return | Terminal return | Output bytes | Exact bytes | Payload accepted |
|---|---|---|---|---|---|
| full-correct | 0 | 1 | 1049 | Yes | Yes |
| full-alias | 0 | 1 | 1049 | No | No |
| full-wrong-id | -3 | -3 | 0 | No | No |
| full-missing | Not called | 2 | 0 | No | No |
| partial-correct | 0 | 1 | 215 | Yes | Yes |
| partial-alias | 0 | -3 | 215 | No | No |
| bad-trailer | 0 | -3 | 1049 | Yes | No |
| truncated | 0 | -5 | 1049 | Yes | No |
The wrong-ID dictionary fails during setup. The partial-copy control accepts the aliased dictionary but fails the output check: its payload omits one of the three balancing changes. A damaged or truncated trailer can leave all expected bytes in the C buffer without successful stream completion. Ordinary checks remain useful; keep them enabled.
Two checked fields do not automatically give independent evidence. This deliberate collision does not estimate a field failure rate, but multiplying two nominal 32-bit miss probabilities would assume away this coupled error mechanism. Bind exact dictionary bytes and intended output to trusted metadata. Hashing only the compressed file cannot detect this substitution because that file never changed.
Maxino and Koopman's checksum study evaluates specified independent-bit and burst-error models, with outcomes depending on data and codeword length. Our dictionary substitution is a different error process: one selected dependency carries a balanced change into the decoded output. Their network error probabilities cannot be transferred to this constructed case. Use an explicit error model before estimating an undetected-error rate.[Checksum study, sections 3 and 3.5]
All eight controls as JSON / Raw observations and fixture hashes / Primary-source map / Runnable evidence package. The package includes synthetic inputs and C, Python and Node checks; its README separates frozen-input replay from fresh compression. No hardware faults, natural collisions or population failure rates were measured.
A stored checksum is not an executed check
RFC 8878 allows decoders to ignore checksums. Our CLI comparison makes that choice explicit: the same checked frame and wrong raw dictionary failed under --check, but returned wrong bytes and exit zero under --no-check. The frame still contained its checksum. Verification was disabled at read time, not omitted at write time. [RFC 8878]
We also flipped one bit in the final checksum byte of the dictionary-free control, leaving compressed data unchanged. Verification rejected it; ignoring the checksum returned all 2,048 correct payload bytes. This isolates a checksum discrepancy from payload damage. It does not recommend suppressing verification, nor establish that arbitrary damaged files are recoverable.
Correct payload, changed metadata
A skippable frame carries user metadata that a normal Zstandard decoder passes over. We prefixed the checked control with generation=0001, then changed it to the equally long generation=0002. Both streams returned the same 2,048-byte payload with a successful checksum check and identical decoded SHA-256, despite different compressed-stream hashes. This is metadata exclusion, not a hash collision. [RFC 8878]
The table's Payload accepted column intentionally retains the original narrow oracle. It cannot attest to skipped metadata. When such metadata matters, verify it separately or bind the complete stored object to a trusted digest. The existing compressed-object identity check below would detect our mutation; checking only the decoded length and hash would not.
One archive name, different recovered bytes
A correct decompression can still leave an ambiguous file selection. In a TAR containing two regular entries named record.txt, GNU tar restored the last entry to disk but sent both payloads to standard output. Every one of those calls succeeded. The archive bytes remained unchanged.
We constructed four USTAR archives: A then B, B then A, B twice, and a single B. Each payload is 13 bytes. A has modification time 200; B has time 100. Eight reader operations per archive ran on tar (GNU tar) 1.35 and Python 3.12.3. Before reading, each TAR passed an exact gzip compression/decompression round trip. The experiment then used the decoded TAR, isolating member selection from the codec.
| Reader operation | Archive A then B | Archive B then A |
|---|---|---|
| GNU tar: extract to disk | B | A |
| GNU tar: extract to stdout | A+B | B+A |
| GNU tar: occurrence 1 | A | B |
| GNU tar: occurrence 2 | B | A |
| Python: extractfile(name) | B | A |
| Python: first TarInfo | A | B |
| Python: loop over TarInfo objects | A+B | B+A |
| Python: loop, re-lookup each name | B+B | A+A |
Archive order is not modification-time order
GNU tar permits repeated names, including when appending another version. Default extraction processes the entries in archive order, so the later entry replaces the earlier file. [TAR append] In A then B, the observed result was B despite its lower modification time. Reversing the entries produced A. Neither result establishes the application's intended recovery version.
With -xOf, GNU tar concatenates selected members in archive order. [TAR stdout] A pipeline that substitutes standard-output extraction for disk extraction therefore needs a new acceptance check. Even B followed by identical B emitted 26 bytes rather than the required 13; identical duplicate content did not make the two recovery paths equivalent.
A Python inventory can accidentally read the same entry twice
getmember(name) selects the last occurrence; getmembers() retains archive order. Passing a specific TarInfo to extractfile() selects that entry. [Python] Our correct member-object loop read A+B. Replacing its argument with member.name read B+B from the same A-then-B archive. The lengths were identical. An entry-by-entry checker must preserve entry identity, not only its name.
Define the selection rule before restoring
GNU tar's --occurrence=1 and --occurrence=2 selected the respective entries. Requesting occurrence 2 from the single-entry control failed with exit code 2 and empty output. [TAR occurrence] Selecting one occurrence is not a whole-archive integrity check; GNU tar may stop scanning once the requested occurrence is found.
Our engineering recommendation: either reject duplicate names in a format that requires one file per path, or retain archive identity, entry order/occurrence, member type and expected payload digest. Verify the actual restored output against an independently chosen requirement. Here the requirement was exactly B, fixed before creating any archive. A manifest keyed only by pathname can silently lose the distinction between stored entries.
The strict duplicate-name policy rejected all three repeated-name fixtures, including B+B. That is a policy choice, not proof that TAR duplicates are invalid. This check covers literal names only; path normalization, links and filesystem aliases need separate handling. These four designed fixtures do not validate a hostile-archive extractor, metadata restoration or production failure rates.
Reproduction script / 32 operations, full outputs, versions and SHA-256 records / archive-member definition. Only generated files inside a private temporary directory are extracted. The runner accepts no external archive and refuses an existing result file.
python3 tar-member-selection.py --output members.jsonA selected hard link can restore old destination bytes
In our intact target-first TAR, selecting alias into a directory with an old target completed without error in GNU tar 1.35 and both tested Python builds. The alias then contained the old bytes. Both generations were 29 bytes long: existence, size and completion checks all passed, but the required content did not.
GNU tar generated five benign USTAR fixtures; each underwent eleven operations. The table shows the target-first fixture: a regular target followed by a payload-free hard-link entry alias. Each operation used a fresh disposable directory, with a stale or matching target seeded only where specified. Python disk extraction explicitly used filter="data" and errorlevel=2.
| Operation / destination | Completed | Selected bytes | Shares target file |
|---|---|---|---|
| GNU tar: full restore, empty | Yes | Expected | Yes |
| GNU tar: alias, empty | Nonzero status | No alias | - |
| GNU tar: alias, stale target | Yes | Stale | Yes |
| GNU tar: alias, matching target | Yes | Expected | Yes |
| GNU tar: alias to stdout | Yes | 0 bytes | - |
| Python: full restore, empty | Yes | Expected | Yes |
| Python: alias, empty | Yes | Expected | - |
| Python: alias, stale target | Yes | Stale | Yes |
| Python: alias, matching target | Yes | Expected | Yes |
| Python: seekable extractfile | Yes | Expected | - |
| Python: streaming extractfile | StreamError | No alias | - |
Destination state is part of the read contract
GNU documents the dependency of selected hard-link extraction on its target. [GNU hard links] Python's pinned implementation first tries an existing disk target; if absent, it can copy the earlier archive member. Its seekable extractfile resolves archive content, while the streaming link path raises StreamError. That explains the measured contrast, without promising the same behavior for every reader. [Pinned implementation]
Overwrite protection is a different requirement. In twelve additional GNU tar 1.35 controls, full extraction over a stale target with --skip-old-files returned status 0 while the alias shared stale bytes; --keep-old-files returned status 2 with the same stale payload. Selecting only the alias returned status 0 with stale bytes under both options and the default policy: no target overwrite was attempted. Empty-destination full restores succeeded; alias-only restores failed. These are synthetic cases on one binary, not a failure-rate estimate. [GNU policy] [Twelve controls]
Equal payloads do not preserve shared-file identity
Reversing input order made alias the payload-bearing entry. Archiving only that name also made it self-contained. With --hard-dereference, both names carried regular payloads: full restoration returned correct bytes but separate files. After normalized metadata, this archive was byte-for-byte identical to one made from independent equal-content source files. Inference: these archive bytes alone cannot recover the discarded sharing relation. Per-path hashes are insufficient for that requirement.
Zwicky's LISA 2003 study compared restored content and metadata separately and highlighted encounter order for hard-linked names. Its operating-system selection was pragmatic, not a random sample. We use that methodological lesson, not its historical results as a modern reliability estimate. [LISA paper]
Recovery rule: use isolated staging, restore required link targets and check the expected generation. If shared-file relationships matter, verify them separately using live device/inode pairs; equal hashes do not establish sharing. Our write-through probe runs only on disposable fixtures, never on a real backup.
The 55 configurations were replayed on CPython 3.12.3 and 3.12.15 with one GNU tar 1.35 binary on one Linux host. These are not independent reliability trials, a security audit or a newly discovered vulnerability. ACLs, xattrs, hostile paths, crashes and throughput are outside scope. The reproduction bundle contains code, tests, provenance and complete observations; raw JSON is also available. See archive member and hard link.
A successful selected read can miss damage elsewhere
In a separate three-fixture experiment, --occurrence=1 returned the correct first file with exit zero even when a later header was damaged. Reading the same named file without that option returned the same bytes but exited with code 2. GNU tar documents that occurrence selection can finish before scanning the rest of the archive. [TAR occurrence]
Each 10,240-byte USTAR contains two distinct regular files: record.txt holds first plus a newline, and tail.txt holds later plus a newline. Starting from the intact control, we independently flip bit 0 at byte offset 1,024 (the later header's filename) or 1,536 (the later payload). The header checksum is left unchanged. Four reader commands run on each plain TAR with tar (GNU tar) 1.35; there is no compression wrapper in these twelve operations.
| Fixture | First file, occurrence 1 | First file, default | List all | Later file, default |
|---|---|---|---|---|
| Unchanged control | 0first | 0first | 0record.txt + tail.txt | 0later |
| One bit in later header | 0first | 2first | 2record.txt | 2Empty |
| One bit in later payload | 0first | 0first | 0record.txt + tail.txt | 0mater |
Listing all names still leaves payloads unchecked
The payload mutation changed later to mater without changing its length or either header. All four commands exited zero, including the full listing; extracting tail.txt returned an incorrect six-byte payload. The USTAR checksum covers the header, not the file contents. [TAR format] Comparing the actual output against the independently retained expected payload rejected this result.
These controls separate selection scope from checksum scope. Removing early completion exposed our bad header, but did not turn listing into a content verifier. Checking the first file's digest would still miss damage to the other file. A trusted digest of the complete TAR detected both mutations; a new digest calculated only from the received archive would not establish that it was the intended original.
Practical rule: record what was checked: one selected member, archive structure, every required member's content, or the complete stored object. Require successful commands and compare against an independently retained manifest at the intended scope. A selective restore is useful; do not report its success as a completed whole-archive validation.
This measures outcomes on one GNU tar build, not physical read coverage: buffered reads may fetch bytes that are never validated. Compressed-input behavior, hostile paths, links and metadata restoration need separate tests. Download the bounded reproduction script and twelve complete results with mutation offsets and hashes.
python3 tar-read-coverage.py --output coverage.jsonGzip can finish while TAR stops at the first archive
Joining two .tar.gz byte strings preserves a valid sequence of gzip members, but also preserves the first TAR's end marker. In this experiment, gzip checked and decoded every compressed member correctly; default TAR readers then returned only the first of three intended files, without an error. Compression completion and container coverage are separate conditions. [Gzip concatenation] [TAR concatenation]
The fixed recovery target is alpha.bin with 17 A bytes, beta.bin with 513 B bytes and gamma.bin with 31 C bytes: 561 bytes in total. Eight fixtures run six reader operations each on tar (GNU tar) 1.35, gzip 1.12 and Python 3.12.3. Every fixture first passes gzip -t and complete decompression, with exact comparison to the constructed TAR. The table shows payload reads; separate name listings and all diagnostics are in the JSON.
| Fixture | GNU default | GNU -i | Python default | Python ignore_zeros |
|---|---|---|---|---|
| Combined TAR control | 561 bytes OK | 561 bytes OK | 561 bytes OK | 561 bytes OK |
| Joined TARs, one gzip member | 17 bytes OK | 561 bytes OK | 17 bytes OK | 561 bytes OK |
| Joined .tar.gz byte strings | 17 bytes OK | 561 bytes OK | 17 bytes OK | 561 bytes OK |
| One zero block between entries | 17 bytes OK | 561 bytes OK | 17 bytes OK | 561 bytes OK |
| Final zero markers removed | 561 bytes OK | 561 bytes OK | 561 bytes OK | 561 bytes OK |
| Middle header checksum invalid | 48 bytes Error | 48 bytes Error | 17 bytes OK | 48 bytes OK |
| Entire middle member removed | 48 bytes OK | 48 bytes OK | 48 bytes OK | 48 bytes OK |
| 512 zero bytes inside alpha | 1,056 bytes OK | 1,056 bytes OK | 1,056 bytes OK | 1,056 bytes OK |
Where the zeros occur matters
One gzip member wrapping two terminated TARs and two gzip members wrapping those TARs separately produced identical decoded TAR bytes. Both default readers stopped after alpha; their continuation modes reached all three files. A single zero block between entries also stopped default reading. GNU tar printed a warning but still exited 0. In contrast, a 512-byte zero-filled alpha payload survived intact: zeros inside an entry are data, not an archive boundary. Removing all zero blocks is not a safe repair.
GNU tar documents stopping at zero blocks and the explicit --ignore-zeros continuation option. Its --concatenate operation removes a target archive's end marker; raw byte concatenation does not. That operation is not a validator of the supplied archives, and the documented compressed-archive restrictions still apply. [GNU tar] [Concatenate]
Salvaging more files can still report incomplete recovery as OK
A one-bit change in beta's header, with its stored checksum left unchanged, produced a different split. GNU tar recovered alpha and gamma but exited 2 with both options. Python default returned alpha without an exception; ignore_zeros=True returned alpha and gamma without an exception. Its documented policy skips invalid blocks as well as zero blocks. The pinned TarFile.next() implementation also treats an invalid later header differently from an invalid initial header, which the negative control rejects. [Python policy] [Implementation]
Deleting beta's entire member left a structurally readable archive. Every reader completed successfully, yet every independent content comparison failed. Removing only the final zero markers gave all expected files on these builds. Thus neither a successful parse nor a missing terminator alone determines whether the required recovery content is present.
Recovery implication: preserve an independent inventory and per-entry content expectations, apply an explicit trailing-data policy, and distinguish salvaged output from an accepted restore. More permissive parsing can expose later files; it cannot establish that skipped or absent files were unnecessary. Do not promote partial output just because a reader returned normally.
Check the expected set, not just the files that survived
A loop that verifies every returned file can still accept an incomplete restore: every surviving digest may match while beta is absent. Our payload acceptance example requires explicit reader completion, the exact expected set of literal names, no duplicates, and matching sizes and SHA-256 digests. It derives 16 decisions from the retained Python observations; nine satisfy that narrow policy, seven do not. These are designed cases, not a reliability rate. Policy regression tests include complete output from a failed reader and malformed records.
The expected inventory is fixed before parsing. Rebuilding it from surviving files defeats the check. A pass here says nothing about metadata, safe extraction, unparsed trailing data or authenticity; it is not a TAR-format validation result. BagIt 1.0 makes a related distinction: completeness requires the specified files and manifest coverage; validity additionally requires checksum verification. RFC 8493 is Informational and leaves protection against active attackers to additional measures. Our example is not a BagIt implementation. [BagIt]
Why compare restored state?
Elizabeth D. Zwicky's LISA 2003 study generated filesystem edge cases, ran backup/restore pairs, then compared content and metadata separately. It exercised names, links, permissions and sparse files on RedHat Linux 8.0/ext2, FreeBSD 4.8/UFS and Solaris 5.9. The systems were selected for availability and popularity, not as a representative population. Its useful lesson is methodological: test the actual version, options and environment. Its historical defects do not establish modern failure rates, and our payload-only experiment does not reproduce its filesystem tests. [LISA 2003, pp. 7-10, 13]
Run the bounded harness, inspect all 48 reader observations, and use the 11 regression tests and method and source review. No existing archive or disk extraction is used. Mutations occur before gzip compression, so valid gzip checks correctly cover the altered TAR; this is not gzip missing transport corruption. These version-scoped observations test neither hostile archives nor metadata restoration, compression read-ahead, crash durability or failure frequencies.
A missing incremental can leave plausible old files
In our GNU tar 1.35 fixture, base plus tail restored every expected filename at its expected size and returned zero, but one file still held the base generation. The omitted middle archive contained that file's only update. A successful extraction did not establish a complete recovery chain.
The external .snar snapshot selects changes for --listed-incremental creation and is updated by that operation. Extraction uses embedded archive metadata; it does not require that snapshot. In a directory's dumpdir record, N records a present but unchanged name whose payload was omitted. That name alone cannot repair stale destination bytes. [GNU manual] [Dumpdir format]
We declare three source generations before archiving. The middle changes two eight-byte files and removes a third; the tail changes only one of those two. Seven archives support nine restore procedures, each in an empty temporary directory. All external snapshots are deleted before restoration. Two retained captures agree, and publication review repeated the same native experiment; these are repeatability checks on one host.
| Recovery procedure | Names match | Sizes match | Exact content | Difference |
|---|---|---|---|---|
| Base, middle, tail | Yes | Yes | Yes | None |
| Base, tail: middle omitted | Yes | Yes | No | Stale: data/revised.txt |
| Base, tail, middle | Yes | Yes | No | Stale: data/recent.txt |
| Tail only | No | No | No | Missing: data/revised.txt, data/stable.txt |
| All three; plain extraction | No | No | No | Extra: data/retired.txt |
| Base, generation-2 fork from base cursor | Yes | Yes | Yes | None |
| Base, retry from advanced cursor | Yes | Yes | No | Stale: data/recent.txt, data/revised.txt |
| Base, retry from saved base cursor | Yes | Yes | Yes | None |
| Fresh full backup | Yes | Yes | Yes | None |
Retrying from the advanced cursor does not replace the missing archive. With the generation-1 source unchanged, that retry emitted directory metadata but no regular-file payloads. Restoring it after the base left both changed files stale. Retrying from the saved base cursor re-emitted them. A generation-2 fork from that same base cursor also recovered the intended state with just two archives. Dependency identity, not the number of archives, determines the required recovery set.
Plain extraction retained the deleted file; incremental extraction removed it. Restore drills therefore need an isolated destination. The saved-cursor controls used quiescent source generations: an old cursor cannot recreate historical bytes that no longer exist. We withheld a successfully created archive at restore time, not during an injected upload or creation failure.
Maheshwari, Vingralek and Shapiro's TDB design (OSDI 2000, sections 6.2-6.3) makes the distinction explicit: backup descriptors identify the source, base snapshot and backup set; restoration checks predecessor identity and set cardinality before committing. Its checksum for transfer completeness is separate from that lineage check. This is a design comparison, not a TDB replication or a recommendation of its historical cryptography. [TDB paper]
Source consistency is a separate obligation. TDB first snapshots the source partitions in one atomic commit before copying them (section 6.1). Our tar inputs were quiescent; correct predecessor selection does not demonstrate application consistency under concurrent writes. The paper measures only backup creation in section 9.2.3, so it supplies no restore-time benchmark here. [TDB paper]
Retention follows dependencies, not dates. In this fixture, keeping the base and tail is insufficient, while keeping the base and its generation-2 fork is sufficient. A count of two intact archives therefore cannot identify an acceptable recovery set. Retain every actual predecessor needed by a promised recovery point; an older archive is not redundant merely because a newer one exists. This is an inference from the controlled cases, not a claim that every incremental format requires replaying all earlier backups.
Engineering inference: keep the accepted selection checkpoint associated with its retained recovery generation. Create a candidate with a working copy; validate archive identity, actual predecessor dependencies and restored state before promoting that cursor. A real implementation still needs crash-safe persistence and concurrency control. This experiment does not supply such a wrapper, a failure frequency or a power-loss guarantee.
Inspect the generated results, method and reproduction guide, or code and retained captures. The fixture covers short regular-file names, not renames, links, ACLs, concurrent writers or hostile archives. Continue with incremental backup and backup verification versus restore testing.
All expected bytes can arrive before gzip reports a bad trailer
In our gzip experiment, reading exactly the expected payload length and closing the reader returned every correct byte without an error, even with a damaged checksum or incomplete trailer. Continuing until end-of-file exposed the error. A byte-count target is not the same operation as finishing the decoder.
We generated A (65,536 bytes) and B (32,768 bytes) independently of the compressed inputs. Seven fixtures include clean controls, a one-bit CRC32 mutation, one missing final size byte, two concatenated members, deletion of the entire second member and eight trailing non-gzip bytes. Six operations per fixture ran on CPython 3.12.3 with zlib 1.3. The required output is A for single-member fixtures and A+B for all others.
| Fixture | Expected bytes | Read expected length; close | Read through EOF | zlib single-member call |
|---|---|---|---|---|
| Single member, clean | 65,536 | OK 65,536 bytes | OK 65,536 bytes | OK 65,536 bytes |
| Single member, CRC bit flipped | 65,536 | OK 65,536 bytes | Error 65,536 bytes | Error 0 bytes |
| Single member, final size byte missing | 65,536 | OK 65,536 bytes | Error 65,536 bytes | Error 0 bytes |
| Two members, clean | 98,304 | OK 98,304 bytes | OK 98,304 bytes | OK 65,536 bytes |
| Second member CRC bit flipped | 98,304 | OK 98,304 bytes | Error 98,304 bytes | OK 65,536 bytes |
| Entire second member removed | 98,304 | OK 65,536 bytes | OK 65,536 bytes | OK 65,536 bytes |
| Two members plus non-gzip suffix | 98,304 | OK 98,304 bytes | Error 98,304 bytes | OK 65,536 bytes |
Close does not finish validation on a read handle
The bad single-member CRC and missing-trailer-byte fixtures both returned 65,536 correct bytes from the exact-length read and closed without error. The EOF loop also returned those bytes, then raised BadGzipFile or EOFError on a later read. The whole-buffer gzip.decompress() call raised without returning a result. These are different caller-visible output contracts, not different original payloads.
In the pinned CPython source, read-mode close closes the buffer; trailer checking belongs to the read path. Our successful 16-byte prefix reads also did not expose any of the later damage. Internal read-ahead is not a validation receipt. These observations depend on the tested call sizes and implementation; they do not promise that every partial read defers every possible error. [CPython source]
A completed member is not a completed gzip file
zlib.decompress(input, wbits=31) returned only A from the intact A+B input: 65,536 of the required 98,304 bytes. The object-based equivalent reported eof=True but retained 32,796 compressed bytes in unused_data. The same first-member success hid a bad CRC in member B. zlib's underlying inflate interface stops at a member boundary; the caller must handle subsequent members. Python's gzip decoder supports concatenated members. [zlib 1.3] [Python gzip]
The inverse trap appeared with the truncated single member: decompressobj().decompress() followed by flush() returned all 65,536 bytes without an exception, but eof remained false. An empty unused_data did not prove completion. Record the terminal state as well as output and exceptions. Python distinguishes unused post-stream input from unconsumed_tail, which is input retained because of an output limit. [Python zlib]
Even a fully checked surviving member cannot prove nothing was deleted
Removing B completely left the same valid input bytes as the single-member control. Every whole-input decoder completed successfully, yet returned only A against the separately fixed A+B requirement. No damaged member remained to reject. The expected length and digest detected the omission; a newly calculated checksum of the surviving object would not establish its original identity.
RFC 1952 describes a gzip file as a sequence of members, with a CRC32 and uncompressed size modulo 232 in each trailer. Those fields are not a trusted inventory of the originally intended members. Its minimum decompressor requirements also do not make every trailer field mandatory to check. The measured Python behavior above is stronger, implementation-specific evidence, not a claim that a format name guarantees validation. [RFC 1952, sections 2.2 and 2.3.1]
Recovery rule, inferred from these controls: use a decoder that processes the intended member sequence, propagate read and terminal errors, and compare the complete output with independently retained expectations before publication. For a low-level zlib loop, account for both end-of-member state and remaining input; do not replace multi-member processing with a blanket rejection of all remaining bytes. Define any padding policy separately. The trailing-garbage result here covers exactly NOT-GZIP, not zero padding or every possible suffix.
The standard-library reproduction script and 42 observations with hashes and runtime identity complement the gzip corpus entry. Only bounded synthetic in-memory data are decoded. This is not a corruption rate, performance benchmark, security audit or newly discovered library defect. Counts of returned bytes exclude bytes produced internally by a call that raised.
python3 gzip-read-coverage.py --output gzip-results.jsonGzip listing size and CRC can describe different scopes
GNU gzip 1.14 counts decoded bytes across members, but its displayed CRC still belongs to the last member. A correctly counted length is not a checksum of the complete recovery object. Older versions also differ in their size reporting.
We tested eleven synthetic fixtures through GNU gzip 1.11, 1.12 and 1.14, each as a named file, redirected regular-file input and a real pipe: 99 listing observations. The table selects named-file results. A contains 4,096 bytes, B contains 17; the large single member decodes to 4,294,967,313 zero bytes (4 GiB + 17). Values are generated from the retained observations.
| Fixture | GNU gzip | Listed size (B) |
|---|---|---|
| A+B | 1.11 | 17 |
| A+B | 1.12 | 17 |
| A+B | 1.14 | 4,113 |
| A+B+empty | 1.11 | 0 |
| A+B+empty | 1.12 | 0 |
| A+B+empty | 1.14 | 4,113 |
| 4 GiB + 17 B | 1.11 | 17 |
| 4 GiB + 17 B | 1.12 | 4,294,967,313 |
| 4 GiB + 17 B | 1.14 | 4,294,967,313 |
On a pipe, the tested 1.11 build instead reported unknown sizes (-1) and exited zero. Redirecting a regular file to standard input is still seekable and is not the same control. Unknown is neither zero nor an unsigned capacity.
The format field does not determine what a tool can count
Each member stores ISIZE modulo 232, but a decoder can count more bytes and sum across members. GNU 1.14's release notes record the multi-member listing fix. Its implementation retains an aggregate output counter while checking each trailer against that member's output. The bundled manual still states that listed size applies only to the last member: a documentation inconsistency in this exact release, resolved here using source inspection and executable controls. [RFC 1952] [GNU release notes] [Pinned release source]
Equal listing fields do not identify equal output
Appending an empty member changes the 1.14 displayed CRC from 0e76bab7 to 00000000 without changing the decoded bytes or total size. More strongly, correctly recompressing a changed first member leaves all numerical listing fields identical to the original: compressed size, decoded size, ratio and displayed CRC. Both full decodes succeed, but their whole-output SHA-256 digests differ. This is a scope mismatch, not a CRC collision.
Recovery consequence: budget actual decoded output, retain terminal decoder errors, and compare against independently recorded expectations for the intended version. GNU 1.12 and 1.14 perform decompression during listing, so listing can already do the work an output budget is meant to constrain. Removing an entire valid member also requires an external inventory or content expectation to detect the omission.
The reproduction packet contains fixtures, code, tests, source hashes and both retained matrices; the 99-row JSON matrix is also directly available. Full replay streams the 4 GiB case without storing expanded output, but still consumes decompression CPU and reads all output. The reproduction guide separates offline evidence checks from native replay.
These are same-host, version-bound controls, not independent peer replication, a performance benchmark or an arbitrary-input security validator. GNU 1.13, later releases, other platforms, metadata restoration and crash durability were not tested. The gzip record retains the format and reader-completion distinctions.
Which gzip checks did the reader actually perform?
Correct decoded bytes do not establish header validation. In a separate experiment, CPython 3.12.3 returned the complete expected payload from headers with a deliberately stale checksum. The tested gzip-aware zlib 1.3 and GNU gzip 1.12 paths rejected the same input.
The data trailer covers the decoded payload, not header metadata such as the timestamp, optional filename, comment or extra fields. Optional FHCRC stores the low 16 bits of the header's CRC32. RFC 1952 permits a decompressor to skip this check, but separately requires an error for nonzero reserved flag bits. Those are different acceptance requirements. [RFC 1952, sections 2.3.1 and 2.3.1.2]
Twenty synthetic header/input fixtures and fourteen separate flag controls were each tested through seven operations: 238 observations per capture. Metadata mutations leave compressed data and the data trailer unchanged. Reserved-bit controls recompute FHCRC where present, so a stale header checksum cannot explain their rejection. Expected payloads were fixed before encoding.
| Input | Python gzip | zlib | GNU gzip |
|---|---|---|---|
| Unchanged header | OK; 257 bytes | OK; 257 bytes | OK; 257 bytes |
| Timestamp changed; stale FHCRC | OK; 257 bytes | Error; 0 bytes | Error; 0 bytes |
| One FHCRC bit changed | OK; 257 bytes | Error; 0 bytes | Error; 0 bytes |
| Name changed; FHCRC recomputed | OK; 257 bytes | OK; 257 bytes | OK; 257 bytes |
| Reserved bit 0x20; valid FHCRC | OK; 257 bytes | Error; 0 bytes | Error; 0 bytes |
| FTEXT control; valid FHCRC | OK; 257 bytes | OK; 257 bytes | OK; 257 bytes |
| Payload CRC bit changed | Error; 0 bytes | Error; 0 bytes | Error; 257 bytes |
The read-through-EOF Python path agreed with its whole-buffer path. Its pinned parser discards FHCRC and delegates raw DEFLATE decoding to zlib; zlib's gzip-aware parser instead checks the header. Saying that both use zlib does not identify the wrapper checks. In the timestamp control, Python returned MTIME 2 instead of the original 1 while preserving every payload byte. [CPython parser] [zlib parser]
Recomputing FHCRC after changing the filename restored success in every tested operation without restoring the original header. That is checksum recalculation, not a collision or authentication. Separately, Python accepted each reserved bit and their combination; the tested zlib and GNU paths rejected them even with a valid FHCRC. FTEXT controls passed and an invalid compression method failed everywhere. These observations are version-scoped, not certification of a general validator.
A zero return or successful close can hide an earlier failure
Native gzread() exposed another distinction. With a stale header CRC, gzread() returned -1; gzerror() reported Z_DATA_ERROR (-3), followed by gzclose() returning Z_OK (0). The read return and the zlib error code are different values. A truncated trailer returned all 257 expected bytes and eventually a zero read, while gzerror() and close reported -5. Preserve read failures and inspect terminal status before closing; close frees the state. [zlib API]
The same native file API intentionally accepted plain input and ignored the tested NOT-GZIP suffix. Its transparent-reading policy is documented, not proof that the input was a complete gzip object. A single-member decoder also leaves subsequent members for its caller. [gzread implementation]
Recovery implication: specify wrapper and member coverage, required header checks, allowed suffixes and independent payload/metadata expectations separately. A trusted whole-object hash can bind the stored encoding; a trusted manifest can bind selected semantic fields. Neither can be replaced by the digest of decoded bytes when the disputed change exists only in the header.
Download the reproduction package, 140 header/input observations, 98 flag observations and environment comparison. A new same-host replay preserved all fixture bytes and outcomes after kernel and libz-binary changes; the original captures remain intact. These are designed software controls, not a field-risk estimate, a new vulnerability claim or a filesystem-metadata restore test. The gzip record provides the structured summary.
Matching results and matching environments are separate checks
A version label is not a binary identity. For a historical replay, preserve the original captures, compare inputs and observed behavior first, and report interpreter, library and platform differences separately. Compare the inventory too: a missing environment field is not an unchanged value. Matching these fixtures does not certify other inputs or prove that unrecorded runtime state stayed constant. VXA's warning about testing a native decoder while leaving the archived fallback untested illustrates the broader problem: the exercised recovery path matters. This is an engineering inference from the recorded experiment and VXA section 2.3, not a VXA replication or a guarantee of future compatibility. [VXA, section 2.3]
ZIP validation can lose entry identity and failure status
NPZ adds an array-reader boundary even when member names are unique. A NumPy archive opened and returned its intact first array while another member retained a CRC error; accessing that second array exposed it. See the NPY/NPZ interpretation experiment for selected-read coverage, changed headers and metadata omitted before hashing. This is separate from duplicate-name ZIP selection.
On the tested CPython 3.12.3 build, testzip() returned None for an archive with a damaged first entry and an intact second entry carrying the same name. Reading the first entry by its ZipInfo object raised a CRC error. This reproduces the already reported CPython issue 156539; it is not a new defect discovered by Hesela.
Six two-entry fixtures isolate the behavior. Each payload is 13 bytes, either generation=A or generation=B followed by a newline. Entries use ZIP_STORED, so there is no compression layer. A damaged fixture flips one bit in a selected payload while retaining both stored CRC fields and the rest of the archive. Distinct names, clean duplicates, a damaged last duplicate and reversed order provide controls. Header layout and CRC field locations follow [ZIP APPNOTE, sections 4.3.7 and 4.3.12].
| Fixture | Entry 1 / entry 2 CRC | testzip() result | CLI reports corruption | CLI exit |
|---|---|---|---|---|
| Distinct names, clean | Pass / Pass | None | No | 0 |
| Distinct names, first damaged | Fail / Pass | first.txt | Yes | 0 |
| Duplicate name, A then B | Pass / Pass | None | No | 0 |
| Duplicate name, first damaged | Fail / Pass | None | No | 0 |
| Duplicate name, last damaged | Pass / Fail | record.txt | Yes | 0 |
| Duplicate name, B then A | Pass / Pass | None | No | 0 |
A filename lookup can check the same entry twice
The pinned implementation walks its entry list, but opens each element by filename. Its name lookup retains the last matching entry, so the earlier duplicate's bytes are skipped. Passing the actual ZipInfo retains entry identity, as the API permits. [CPython implementation] [Python API]
In the clean A-then-B control, the entry-object loop read A then B; the name-relookup loop read B twice. Reversing archive order changed the name-loop result to A twice. For the damaged-first-duplicate case, the object loop found the error while the name loop returned two intact B payloads. Identical output length therefore did not establish coverage of both entries. This is the same identity loss seen in the earlier TAR experiment, now inside a validation helper.
A printed failure may still have exit status zero
Each fixture also ran through a fresh python -I -m zipfile -t process. For both the damaged unique entry and damaged last duplicate, the CLI printed a corruption diagnostic and then Done testing, yet exited with status 0. An exit-code-only backup gate would accept all six invocations. That is separate from the duplicate-entry bug: even a detected error did not reach the process status on this build. The pinned CLI source confirms this control flow. [CLI implementation]
Keep three decisions separate
- Coverage: enumerate entries and read each specific
ZipInfoto completion. Do not turn the object back into a name. Propagate read errors and unsupported formats as failed or incomplete validation. - Recovery identity: reject duplicate names when the backup contract requires one file per path. Otherwise bind the intended occurrence to the stored archive and an independent manifest. A clean CRC does not decide whether A or B is the required generation.
- Failure propagation: make the automation's success criterion explicit and test it with deliberately damaged input. Neither a printed completion message nor a zero status from this particular CLI is sufficient.
The harness downloads nothing, accepts no external archive and extracts no files. It records exact payloads, archive hashes, mutation offsets, diagnostics, runtime version and source hashes. These observations apply to the measured build, not every Python release or ZIP reader; upstream fixes require rerunning the controls. Compressed, encrypted and ZIP64 entries, path aliases, extraction safety and adversarial archives are outside this experiment.
Format context: ZIP archive and archive member. Run the bounded experiment or inspect the machine-readable observations.
A ZIP rejection is not destination rollback
A correctly detected error can still leave a damaged destination. On the recorded CPython 3.12.3 POSIX build, a CRC-rejected 257-byte member left an existing verified file empty; a 131,089-byte member left 131,072 bytes of its prefix. A local-header name mismatch raised the same BadZipFile class but preserved that target's previous 33-byte payload. The failure phase, not the exception class alone, determined what had already changed. [Native evidence]
We crossed three scenarios, two payload sizes, three conditions and direct/isolated extraction: 36 designed cases. The scenarios replace a preexisting target, place ./target.bin after an earlier target.bin, or place a distinct before.bin first. A later after.bin reveals whether extraction continued. Central-directory names are unique, and each entry is also read through its specific ZipInfo; this is separate from the preceding name-relookup experiment.
| Condition | Member bytes | Destination bytes after call | Previous target retained | Later member extracted |
|---|---|---|---|---|
| Clean control | 257 | 257 | No | Yes |
| Payload CRC rejection | 257 | 0 | No | No |
| Local-header rejection | 257 | 33 | Yes | No |
| Clean control | 131,089 | 131,089 | No | Yes |
| Payload CRC rejection | 131,089 | 131,072 | No | No |
| Local-header rejection | 131,089 | 33 | Yes | No |
Mechanism: the pinned extractor opens the archive member, opens the destination in overwrite mode, then copies data. Header-name rejection happens at the first step. CRC rejection occurs while reading the member to its end, after earlier chunks may have been written. With the measured 65,536-byte copy buffer, the short failed read returned no chunk; the larger member supplied two chunks before rejection. These lengths depend on the tested stored-data reader and buffering, not on a universal ZIP rule. [ZIP implementation] [Copy loop]
Identity and time interact. In the alias case, the later rejected member destroyed the earlier recovered target at the shared path. In the distinct-name case, before.bin remained after either failure, while after.bin was never extracted. Preserving one target is therefore not archive-wide rollback. This connects the destination-identity problem to the output-publication boundary.
Engineering inference: keep extraction away from the last good copy until payload verification, expected-inventory checks and destination-name mapping checks pass; define commit separately. All isolated controls preserved the original byte/name inventory because they never wrote there. Even clean staging results were never promoted: this tests isolation, not an atomic or crash-safe publication protocol.
Why promotion needs its own evidence. Pillai et al.'s OSDI 2014 study used ALICE to construct crash states from application system-call traces and check application invariants under explicit persistence models. Its discussion of safe rename distinguishes namespace replacement from the ordering of file-data persistence. That historical study motivates a separate crash-consistency review; it neither tested this ZIP extractor nor validates a particular restore-promotion protocol. [ALICE, sections 3 and 4.4]
Two original captures and a fresh same-host replay agree. These are deliberate counterexamples on one build, not independent replication or incident frequencies. We did not test compression, encryption, ZIP64, hostile paths, symlinks, concurrency, metadata preservation or crashes. Read the method and environment lock, inspect the machine-readable summary and download the complete reproduction package. Related corpus: ZIP archive and restore test.
XZ: a printed checksum is not a verified payload
Detailed XZ listing can print an unchanged CRC64 and decoded size after payload damage. Our unchanged file and one-bit payload mutation produced byte-identical xz --robot --list -vv output, but full testing rejected the mutation. The pinned listing implementation reads the stored Check field; this path does not decode the block to recompute it. [XZ listing source]
We generated distinct 256-byte payloads A and B, encoded each with CRC64 and A separately with no payload check. Nine synthetic fixtures compare four reader operations on XZ Utils/liblzma 5.4.5. Each process uses one thread; the runner verifies its single literal LZMA2 chunk layout before changing one bit. This is a controlled counterexample set, not a sample of naturally occurring failures.
| Controlled input | List exit | Test exit | Decode exit | Output / expected bytes | Exact match |
|---|---|---|---|---|---|
| CRC64, unchanged | 0 | 0 | 0 | 256 / 256 | Yes |
| CRC64, payload bit changed | 0 | 1 | 1 | 256 / 256 | No |
| CRC64, stored-check bit changed | 0 | 1 | 1 | 256 / 256 | Yes |
| Stream-header CRC bit changed | 1 | 1 | 1 | 0 / 256 | No |
| No payload check, unchanged | 0 | 0 | 0 | 256 / 256 | Yes |
| No payload check, payload bit changed | 0 | 0 | 0 | 256 / 256 | No |
| Two CRC64 streams A+B | 0 | 0 | 0 | 512 / 512 | Yes |
| Same streams reordered B+A | 0 | 0 | 0 | 512 / 512 | No |
| Second stream removed | 0 | 0 | 0 | 256 / 512 | No |
Present, supported and actually checked are different
With Check=None, the changed literal payload passed full testing and decoded to the wrong 256 bytes. With CRC64, it failed ordinary decoding but returned the same wrong bytes with exit zero under explicit --ignore-check. A separate stream-header CRC mutation still failed with that option. Conversely, changing only the stored data-check bit produced all correct payload bytes but a failed final status. Consumers must retain both output identity and terminal validation status; these controls do not justify suppressing errors in a real recovery. [XZ manual]
Check presence alone also does not establish decoder support. The liblzma API provides LZMA_TELL_NO_CHECK and LZMA_TELL_UNSUPPORTED_CHECK notifications; a caller requiring verified data must handle them. Unsupported-check builds are a documented boundary, not an experiment performed here. [Decoder policy]
Valid stream checks do not bind the intended sequence
Reordering complete CRC64 streams from A+B to B+A preserved stream count, total decoded length and successful checks, yet changed the intended 512-byte output. Removing the second whole stream also left a valid file, now returning only 256 bytes. These are not checksum collisions: each surviving stream still checks its own unchanged content. XZ framing and indexes do not supply our external assertion that this backup must contain A followed by B. [Format sections 2, 3.4 and 4]
Engineering inference: bind the intended generation to an independently retained full-content expectation, complete the required decoding and checks, and propagate failures before accepting output. A checksum printed by an inspector is not evidence of comparison. A backup manifest reconstructed from surviving streams cannot establish what was meant to survive.
Streaming callers must define completion
The documented liblzma 5.4.5 streaming API adds a caller obligation: with LZMA_CONCATENATED, lzma_code() cannot report LZMA_STREAM_END until the caller uses LZMA_FINISH. Supply that action when no further input will arrive, then continue until completion or an error. A filled output buffer is not the completion signal. Check-type notifications identify the available policy; they do not announce a completed payload comparison. These are API requirements from the pinned header, not additional native cases in the table. [Decoder flags]
Completion also has a scope. In XZ for Java 1.10, SingleXZInputStream stops after one XZ stream, leaving following input unread; XZInputStream processes concatenated streams to input end or error. Both document an extra read() after the expected decoded length: require -1, not merely a full buffer, so footer processing can finish. A short positive read can precede a pending exception on the next non-empty read. [Single-stream API] [Complete-file API]
For an embedded stream, its end can be the intended boundary. For a standalone backup file, that same boundary can leave later streams unexamined. Choose the reader for the intended scope, keep check verification enabled, and still compare with the independent content expectation. This is source review of the Java APIs, not a Java execution or an extension of the native table.
Ask where in the data lifetime verification happens
Zhang and colleagues' End-to-end Data Integrity for File Systems: A ZFS Case Study (FAST 2010) used disk and memory fault injection on a historical Solaris/ZFS configuration. Their block-lifecycle analysis distinguishes checksum generation, disk-read verification and later cached use; compression also changes the protected representation. [Sections 4.2, 5.1.2 and 5.3]
The useful comparison is methodological: identify the bytes, operation and point in time that a check covers. Our XZ listing controls are not a reproduction of that filesystem study, and its results are not current OpenZFS or XZ failure-rate estimates. Neither study turns the mere presence of a checksum into end-to-end acceptance.
Download the self-contained reproduction package, inspect the nine-row data and 36 recorded reader observations, and follow the reproduction guide. The package retains both captures, the exact runner and regression tests. Repeated runs on one binary establish repeatability, not independent implementation evidence. No benchmark, arbitrary damaged-archive guarantee, authenticity or crash-durability claim is made.
FLAC: a configured check is not an executed comparison
A successful full decode can occur without the requested MD5 comparison. In selected native controls on libFLAC 1.4.3 and 1.5.0, seeking to sample zero disabled comparison although the configuration getter stayed true and all 4096 samples per channel were returned. A fresh enabled read rejected the wrong stored sum at finish(); seeking and then resetting restored that rejection. This reproduces the documented API behavior, not a newly discovered codec flaw. [Decoder API] [Version-pinned contract]
| Fixture and operation | Samples returned | MD5 setting | Error callbacks | Process result | Finish result |
|---|---|---|---|---|---|
| Intact; checking enabled | 4096 | true | 0 | true | true |
| Wrong MD5; fresh full read | 4096 | true | 0 | true | false |
| Wrong MD5; default settings | 4096 | false | 0 | true | true |
| Wrong MD5; seek to zero | 4096 | true | 0 | true | true |
| Wrong MD5; seek then reset | 4096 | true | 0 | true | false |
| Unset MD5; checking requested | 4096 | true | 0 | true | true |
| Damaged frame; default settings | 3840 | false | 3 | true | true |
| Damaged frame; read suffix | 2048 | true | 0 | true | true |
The C observer records errors and permits continued processing. The damaged-frame/default row reached end-of-stream with three error callbacks and only 3840 of 4096 samples, despite both true results. The suffix row covers only samples 2048 onward. Neither establishes full-file acceptance. The normal flac CLI rejected this damaged file on both builds; the table must not be read as evidence of silent CLI acceptance.
Missing reference and mismatched reference are also different. For the unset-MD5 fixture, flac -t -s returned zero with a warning; flac -t -s -w returned one. Warning escalation rejects this tested missing-reference case, not every preservation failure. [CLI policy]
Sample equality is narrower than preservation of meaning. Valid encodings of the same sample bytes at 48 and 96 kHz had equal sample MD5 values but different declared durations. Changing the channel-mask comment from front to back speakers left every audio-frame byte unchanged and passed strict CLI testing. These are same-input digest examples, not MD5 collisions or playback measurements. The rate variant was consistently re-encoded, not patched into incompatible frame headers. [RFC 9639, sections 8.2 and 8.6.2]
For a library-based full pass, enable checking before initialization, require a nonzero stored reference, track callback errors and intended coverage, avoid seeking during validation, and inspect the finish result. The getter alone cannot certify execution. When reusing a decoder for another file, re-enable the setting before each initialization: finish() restores the defaults, whereas reset() restores checking from the current configured value. [Decoder lifecycle] For exact-file preservation, retain a previously trusted external file/version manifest; for a migration allowing re-encoding, specify sample sequence, rate, channel meanings, bit depth and required metadata separately.
These are deterministic controls on two versions and one host, not corruption rates, independent peer replication, a hardware experiment or an all-decoder guarantee. Inspect the generated table, claims linked to observations, method and replay guide and complete reproduction package. The original captures and diagnostics are retained without editing. See also the Checksum record and checksum scope and object identity.
CPIO: a checksum error can still return success
The CPIO format named crc stores a 32-bit unsigned byte sum, not a cyclic redundancy check. It covers payload bytes, not the member name and permissions. A permutation preserves the sum; a compensating byte increase and decrease can preserve it too. These are algebraic properties, not estimated corruption probabilities. [CPIO format] [Format manual]
Our eleven synthetic fixtures contain one 23-byte regular file. The unchanged payload's sum is 1573. Two retained captures compare four GNU cpio 2.15 operations with a libarchive 3.7.2 reader loop that reads each returned entry to data EOF and iterates headers until archive EOF, stopping on error. Fresh same-host replays match the retained observations; these are repeats, not independent replication. The original bytes, commands, diagnostics and runtime fingerprints are available below. Archive EOF is a parser event: the pinned reader returns it at TRAILER!!!, so it does not prove that every trailing input byte was examined. [Reader source]
A one-bit payload change made GNU verify-only, stdout and disk extraction report a checksum error while returning exit status 0. Listing printed the name without a checksum diagnostic. The tested libarchive reader returned the changed bytes and reached archive EOF without reporting that mismatch. This is version-specific behavior: GNU's relevant paths call error(0, ...), while the pinned libarchive reader does not implement the comparison. [GNU source] [Options] [Reader source]
| Fixture | Sum comparison | GNU verify exit | GNU diagnostic | libarchive reaches EOF | Recovery contract |
|---|---|---|---|---|---|
| crc: unchanged | match | 0 | No | Yes | Pass |
| newc: unchanged | absent | 0 | No | Yes | Pass |
| One payload bit changed | mismatch | 0 | Yes | Yes | Reject |
| Two bytes swapped | match | 0 | No | Yes | Reject |
| Balanced byte changes | match | 0 | No | Yes | Reject |
| Filename changed | match | 0 | No | Yes | Reject |
| Permissions changed | match | 0 | No | Yes | Reject |
| Stored sum changed | mismatch | 0 | Yes | Yes | Reject |
| Changed data, new sum | match | 0 | No | Yes | Reject |
| newc: payload bit changed | absent | 0 | No | Yes | Reject |
| Payload truncated | incomplete | 2 | Yes | No | Reject |
The permutation and balanced-change rows alter bytes without changing the stored sum. Resealing is different: it replaces the sum after altering data. Name and permission changes leave the payload hash intact because those fields are outside the sum. The truncated-payload control makes GNU return 2 and libarchive fail a data read; the probe can observe failures.
Recovery implication: checking only exit status accepts the measured GNU mismatch. Checking diagnostics still misses equal-sum changes and uncovered metadata. Compare against an independently trusted expectation of contents, inventory and required metadata, in isolated staging before accepting output. A hash calculated only after receipt cannot establish the intended original.
Output is not acceptance: the measured GNU stdout and disk-extraction modes expose the altered payload despite the checksum diagnostic. Do not send unchecked stdout directly to an irreversible downstream operation. Stage the output, finish the checks, then release it. This is an engineering consequence of the recorded output, not a crash-durability protocol.
BagIt distinguishes inventory completeness from checksum validity, without promising protection against replacement of both data and manifests. Its payload manifest records paths and content digests; those fields alone do not verify POSIX permissions. Required filesystem metadata must be recorded and checked separately, whether carried in additional bag metadata or another recovery manifest. [BagIt, sections 2.1.3, 3 and 5.4]
This is not a kernel boot or secure-boot experiment. Linux v6.8's regular-file unpacking path does compare the sum; a userspace reader result cannot be transferred to that path. Inputs here are uncompressed, with no hostile paths, links, ACLs or xattrs. No field failure rate, durability guarantee or hardened-extractor claim is made. [Kernel source]
Inspect the eleven-row data, full native observations and source fingerprints; download the self-contained reproduction package or follow its guide. Related definitions: checksum and archive member.
A decoder window limit is not an output budget
A valid, highly compressed stream can still overwhelm its destination. The Zstandard window describes decoding history, not the cumulative number of bytes a restore may write. A decompression bomb exploits resource amplification; malformed input is not required. [RFC 8878] [CWE-409]
We separately encoded a 2 MiB string of repeated ASCII A bytes with window settings of 1 KiB and 2 MiB. Both frames include content checksums and deliberately omit the optional content-size field. The small-window frame produced 2 MiB under -M1MiB; the large-window frame was refused at that limit and accepted under -M4MiB. Concatenating two small-window frames produced 4 MiB under the same -M1MiB setting.
| Window bytes / frame | Frames | Decoder limit (bytes) | Stored bytes | Decoded bytes | Exit / exact match |
|---|---|---|---|---|---|
| 1024 | 1 | 1048576 | 8213 | 2097152 | 0 / Yes |
| 2097152 | 1 | 1048576 | 86 | 0 | 1 / No |
| 2097152 | 1 | 4194304 | 86 | 2097152 | 0 / Yes |
| 1024 | 2 | 1048576 | 16426 | 4194304 | 0 / Yes |
The two large-window rows use identical compressed input. Only the decoder limit changes. The small-window rows demonstrate that even a valid stream with modest history requirements can exceed that setting in total output. These deliberately repetitive inputs are not representative compression ratios, hostile workloads or a measurement of memory consumption. The resource supplement measures CLI window-limit acceptance, not actual peak memory.
The pinned library API documents ZSTD_d_windowLogMax as a streaming-window allocation restriction, not a single-pass decoding limit or a process-wide memory ceiling. ZSTD_getFrameContentSize() describes only the first frame, can return an unknown-size result, and must not be trusted blindly for allocation. Those API facts are documentation findings; this experiment uses the CLI, not a direct library call. [Zstandard API]
Engineering implication: impose separate limits on accepted window size, cumulative decoded bytes and processing time. Count output across all frames before forwarding bytes beyond the allowed budget. A size field can support early rejection, but cannot replace runtime accounting. If a container permits nested archives or many entries, bound those dimensions separately. The harness below is a fixed-input demonstration, not a safe untrusted-archive extraction service.
Python Zstandard: the wrapper changes the acceptance boundary
On the tested python-zstandard builds, an option named max_output_size did not cap every returned payload. A frame declaring 4096 decoded bytes returned all 4096 with the argument set to 64. The same payload encoded without a content-size field raised an error at 64. This is a binding-level observation, distinct from the CLI window-limit experiment above.
We ran 48 call configurations on each of the C-extension and CFFI backends in python-zstandard 0.24.0 and 0.25.0: 192 observations on CPython 3.12.3, Linux x86-64, with libzstd 1.5.7 in both wheels. Twelve deterministic inputs cover known/unknown sizes, appended frames, checksum damage and truncation. Complete frames request a content checksum. The nonempty first payload is 4096 bytes; the second payload B is 14 bytes. These are small correctness controls, not measured memory consumption or archive failure rates.
| Controlled case | C extension | CFFI |
|---|---|---|
| Known size; argument 64; strict | Returns 4096 bytes | Returns 4096 bytes |
| Unknown size; argument 64; strict | Raises ZstdError | Raises ZstdError |
| Known size plus B; default suffix policy | Returns 4096 bytes | Returns 4096 bytes |
| Unknown size plus B; buffer 4096; strict | Raises ZstdError | Raises ZstdError |
| Unknown size plus B; buffer 8192; strict | Returns 4096 bytes | Raises ZstdError |
| Empty frame; damaged checksum; strict | Returns 0 bytes | Returns 0 bytes |
| Empty frame; header only; strict | Returns 0 bytes | Returns 0 bytes |
| Empty frame; damaged checksum; object API | Raises ZstdError; eof=False | Raises ZstdError; eof=False |
| Empty frame; header only; object API | Returns 0 bytes; eof=False | Returns 0 bytes; eof=False |
A larger buffer changed strict suffix handling
For an unknown-size first frame followed by B, both backends rejected the extra frame with an exact 4096-byte buffer and strict suffix handling. Increasing the buffer to 8192 made the C extension return only the first payload, while CFFI still rejected the suffix. The input did not change. The pinned C source places the extra-input check in an else if after the output-resize branch; CFFI has no corresponding resize alternative. Known frame size selects allocation directly in both implementations. [C source] [CFFI source]
Empty output did not prove that an empty frame was checked
Both one-shot backends returned empty bytes for a checksum-damaged empty frame and for its six-byte header alone, even with strict suffix handling. Their declared-zero-size path returns before streaming decode. Incremental object controls rejected the bad checksum and reported eof=False for the header-only input. Payload equality alone would accept both empty results. This is not evidence that the format checksum failed to detect damage; those one-shot paths did not establish full-frame validation. [C source] [CFFI source]
For recovery, record the package version, backend and API as well as the codec. Keep resource admission, terminal completion, input coverage and expected object identity separate. Incremental eof and unused_data help distinguish these obligations, but an incremental call may allocate output before a caller checks its size: substituting decompressobj() is not a production memory limit. Valid concatenated frames are permitted by the format; rejecting B is the chosen one-frame policy, not a finding that B is invalid. [API documentation] [RFC 8878, section 3.1]
A separate-session replay passed all 13 regression tests in normal and optimized Python modes on both pinned versions. This is same-host repeatability, not external peer replication. No result here certifies other wrappers, architectures or releases. As with the VXA lesson below, test the recovery path that will actually run, including its acceptance checks; we did not run VXA.
Table and source hashes / 0.24.0 observations / 0.25.0 observations / Runnable evidence package / Review and reproduction notes.
An overlooked FAST lesson: preserve the decoding path
Bryan Ford's FAST 2005 VXA paper packaged decoders with compressed content and ran them in a restricted x86-32 environment. Its six-codec evaluation used kernel sources and media files on an Athlon 64 system. Figure 7 measured user-mode CPU time, not end-to-end restore time. The reported slowdown reached 11% relative to native x86-32 after a Vorbis adjustment; it is not a modern hardware estimate. [VXA paper]
Section 2.3 makes a practical distinction: testing a native decoder does not test an archived fallback decoder. Section 2.5 limits the proposal to decoding compressed streams, not preserving every document's semantics. We reviewed the paper, but did not run VXA or audit its historical sandbox. The lesson here is to test the actual future recovery path, not to execute old embedded code without isolation. [VXA paper]
A runnable decoder still needs an acceptance check
Isolation and correct output are separate properties. VXA section 2.4 explicitly allows a buggy isolated decoder to produce garbled output even when the virtual machine protects the host. Applied to our CPIO results, retaining a runnable reader also retains its verification policy; reproducible execution alone does not establish the intended recovered content. Preserve an independently trusted acceptance check alongside the decoding path. This is our engineering synthesis of VXA and the end-to-end argument, not a VXA experiment or a proof that an old sandbox remains secure. [VXA, section 2.4] [End-to-end paper]
Compressed indexes also need decoding metadata
Elias-Fano stores ordered integers in low-bit and unary high-bit streams. Auxiliary indexes enable efficient access; payload bits alone are not a complete searchable structure. [Vigna, sections 4-7]
Partitioning can exploit local clusters, but chunk boundaries and locations cost space too. The published design optimizes a cost that includes metadata. [Ottaviano and Venturini, section 4]
| Input | Plain | Split | Meta | Total |
|---|---|---|---|---|
| Two clusters | 224 | 62 | 62 | 124 |
| Spread | 224 | 222 | 62 | 284 |
The clustered input is 0-15 followed by 1024-1039. The spread input uses floor(i * 1039 / 31) for i=0 through 31. With U=1040 and n=32, one stream uses five low bits per value: 160 low bits plus 64 high-stream bits. Changing the internal gaps does not change that total.
Our two 16-value chunks each subtract their first value. The toy header stores a six-bit partition count, then an eleven-bit base, six-bit value count and eleven-bit local universe per chunk: 6 + 2 * (11 + 6 + 11) = 62 bits. Clustering saves space here; splitting the spread input costs more.
Both layouts receive global n and U externally. The high stream ends at its final one; no trailing empty buckets are stored. Alignment, select indexes and checksums are excluded. This sequential recipe is not the SIGIR implementation. Preserve the encoding parameters and boundaries alongside an index; compact payload is not a recovery plan. The calculation and tests expose every counted field.
RubikFS: the layout is part of the decoding path
RubikFS is a FAST 2026 research extension of EROFS, not a new compression codec or an established upstream feature. Its builder groups similar chunks before compression and can separate hot data. Reordered chunks need mappings back to their logical file positions; a retained compressed block is not, by itself, a complete file-recovery recipe. [Huang et al., sections 4-5]
The existing read-only image comparison explains why equal block-size labels do not imply equal decoded spans. Here, the additional recovery question is whether the retained metadata and reader can reconstruct the original file coordinates, not just decompress a block. [Sections 4.6 and 6.1]
Keep the denominator when reading a headline result
The authors report up to 42.60% higher compression ratio than the compared read-only file-system configurations. The ratio is original bytes divided by compressed bytes. For a fixed original size and the same accounting boundary, multiplying that ratio by 1.426 leaves 1 / 1.426 of the former compressed size: approximately 29.87% fewer compressed bytes, not 42.60%. This is an algebraic interpretation of the reported percentage, not a remeasurement, an average saving or a prediction for another image. [Abstract and footnote 2]
The compression study covers six images and three codecs. The read-amplification experiment instead uses generated openEuler hot-file/page traces in FEMU/QEMU, not startup measurements on six physical devices. Sorting adds work, but total build time can decrease when compression becomes faster (Table 3). Hesela has not reproduced these measurements; the paper's results should remain attached to their images, codec settings and access patterns. [Sections 6.1-6.5]
Fewer bytes can still take longer
| Codec | Read size (MB) | Time (s) |
|---|---|---|
| LZ4 | 16.41 | 1.21 |
| ZSTD | 13.37 | 1.63 |
| LZMA | 10.13 | 3.72 |
LZMA reads less than LZ4 here, yet takes longer. Read volume and decompression cost must be considered together. These are the authors' point results, not confidence intervals or a hardware benchmark reproduced by Hesela. [Table 2 and section 6.4]
For an image-preservation plan, keep the matching reader and the metadata needed to recover file coordinates, then verify recovered files against an independently trusted manifest. That is our engineering synthesis, not a tested RubikFS corruption-recovery result. The seek-table experiment below demonstrates the separate coordinate problem in Zstandard; it is not evidence of a RubikFS defect.
Random access is another contract
For compressed offset and identifier lists, see the separate payload and metadata calculation.
The Zstandard seekable extension splits content into independently compressed frames and appends a seek table in a skippable frame. Entries give compressed and decompressed sizes, with optional checksums. This supports locating a range without decoding everything before it; it is additional structure, not a property guaranteed by any file ending in .zst. [Seekable format]
A successful range read is not a completed integrity check. In a separate Hesela experiment, the v1.5.7 reference seekable decoder returned all 192 expected bytes despite a deliberately wrong final-frame checksum. A whole-input decoder rejected that same physical-checksum fixture. With a wrong seek-table checksum instead, whole-input decoding also succeeded: ordinary decoding skips the index metadata. [Retained native evidence]
The study uses 30 bounded synthetic inputs: three 64-byte data frames, index mutations, empty/skippable controls and two final-checksum mutations. Each capture records 480 isolated actions, including initialization failures and caller exclusions, not independent successful trials. Two retained 1.5.7 captures agree; outcomes also agree when the same reference decoder is linked to libzstd 1.5.5. A separate C caller supplies 119 controls per configuration. Both configurations ran on one host and use one decoder implementation.
| Controlled change | Offset / requested bytes | API result / returned bytes | Matches expected range | Whole-input decoder |
|---|---|---|---|---|
| Index sizes redistributed | 64 / 1 | Success / 1 | No | Success |
| Middle physical checksum changed | 64 / 64 | Success / 64 | Yes | Error |
| Last physical checksum changed | 0 / 192 | Success / 192 | Yes | Error |
| Last index checksum changed | 0 / 192 | Success / 192 | Yes | Success |
| Zero-output entry checksum changed | 0 / 192 | Success / 192 | Yes | Success |
| Last index entry omitted | 0 / 192 | Success / 128 | No | Success |
Correct total size can hide incorrect coordinates
Changing two index lengths from 64/64 to 63/65 preserves their sum. Nevertheless, offset 64 with length 1 returned 0x41 (byte 65), not the required 0x40. This is now an actual reference-API observation, supplementing the earlier coordinate model. An independent physical-frame inventory detects the length disagreement. Matching aggregate length and payload checksums cannot replace the per-frame coordinate comparison.
The call boundary changes which checks finish
For the damaged middle physical or table checksum, a fresh 64-byte request returned the complete frame; ZSTD_seekable_decompressFrame also succeeded. A 65-byte request crossed the boundary and failed. Three consecutive requests of 1, 62 and 1 bytes failed on the last call. The pinned source ends the loop at the requested output position; index-checksum comparison is reached when the streaming decoder reports frame completion. These conditions need not coincide. [v1.5.7 implementation]
Requesting one extra byte is not a general remedy: a 193-byte request at offset zero was clamped to 192 and still did not expose the damaged last checksum. Empty or skippable indexed entries create another gap: zero output does not prove that their entry checksums were checked. Omitting the last entry instead yielded a successful short result of 128 bytes. Check the returned length against an independent expectation.
Validate the inventory, then the intended generation
Engineering inference: fully decode the physical compressed extents with checksum verification, compare every physical frame with its index entry (sizes, offsets, count and optional checksums, including zero-output entries), and separately compare with a trusted manifest for the intended generation. Our physical/index inspector rejects the selected inconsistencies. Even a consistent rebuilt archive can be the wrong generation; this extends the earlier dictionary, gzip and archive-member acceptance distinctions.
Why identity needs context outside the decoded bytes
In An Analysis of Data Corruption in the Storage Stack (FAST 2008), Bairavasundaram and colleagues distinguish checksum mismatches from filesystem block-identity discrepancies. Their system checks whether a block belongs to the file and offset being read; its RAID-level scrub cannot perform that contextual check. This is evidence from a particular storage architecture, not a study of compressed archives. [FAST 2008, sections 2.2-2.3]
Application to archive recovery: a decoded frame can be internally consistent yet occupy the wrong output coordinate or belong to the wrong generation. The archive's own index is not an independent expectation when that index may be damaged. Retain the expected object identity outside the archive, bind it to the intended restore, and compare per-frame geometry as well as bytes. This is an engineering analogy, not an estimate of Zstandard failure frequency.
Keep the source buffer or file alive and unmodified for the seekable reader's lifetime, as its API requires. This experiment uses in-memory initialization, not file/custom-I/O paths, large-block workloads or external dictionaries. Deliberately malformed controls establish scoped counterexamples, not field rates, a benchmark, exploitability or an all-version library claim. [API contract]
Inspect the generated six-row summary, complete native capture and reproduction guide, or download the self-contained evidence package. Source fingerprints, build receipts, repeat captures, C controls and scripts are included. This publication integration checks retained evidence; it is not a fresh native run. Definitions: Zstandard and skippable frame.
BGZF and tabix: preserve the coordinate map
Source review: a compressed file and its lookup index have separate jobs. BGZF supplies independently decompressible gzip blocks; a tabix index selects records by genomic interval. Preserving readable blocks is only part of preserving a usable indexed archive.
Heng Li's 2011 Tabix paper combines hierarchical binning with a linear index to avoid unnecessary seeks. Its evaluation used two biological alignment collections, measuring query time, bytes read and seeks. Those results concern retrieval efficiency, not validation of an index paired with a different data generation. [Tabix paper, sections 2-3]
| Map | Meaning | What it does not establish |
|---|---|---|
| BGZF virtual offset | Compressed block position plus byte position within its decoded content | A cumulative decoded length obtained by subtracting two offsets |
| GZI sidecar | Pairs of compressed block starts and cumulative decoded-byte positions | Which records overlap a genomic interval |
| Tabix TBI or CSI | Sequence and interval lookup into a sorted BGZF data file | That an independently supplied data file is the intended generation |
The virtual offset packs a block position into 48 bits and a position within the decoded block into 16 bits. Comparing such offsets is permitted; treating their difference as a decoded-byte count is not. Changing compression or block boundaries may invalidate stored locations without changing decoded content. The bgzip recompression option explicitly depends on matching compression conditions. [BGZF specification] [bgzip manual]
Coordinates are part of the contract. The command-line query chr1:101-110 is 1-based inclusive; the BED interval chr1 100 110 is 0-based half-open and describes the same ten positions. TBI has a 2^29-base coordinate limit. CSI permits different binning geometry; choosing it does not by itself validate index-to-data identity. [tabix manual] [CSI format]
The TBI field layout contains no mandatory data-file digest. Engineering inference: build the index from the final data, compare representative narrow queries with an independently interpreted sequential reference, then preserve both files and their coordinate conventions as one immutable generation. Record both digests in a trusted manifest. Hashing an already mismatched pair merely preserves the mismatch; sampled queries are checks, not a proof of every possible query. [TBI format]
When a valid index returns no matching rows
Measured counterexample: in our three-record synthetic BED fixture, HTSlib 1.22.1 and 1.24 returned zero rows instead of two with exit status zero when generation B was paired with generation A's valid TBI or CSI index. Both files passed their individual BGZF integrity tests. A successful decoder and a successful query did not establish a correct pair.
Only two chr1 coordinate pairs changed, from around 100000 to around 900000; the chr2 record stayed fixed. Native bgzip and tabix produced both generations. The query chr1:900001-900030 and BED target chr1 900000 900030 cover the same positions using their respective coordinate conventions. No index bytes were patched to create the mismatch.
| Pair state | Data integrity | Expected rows | Indexed rows | Sequential target rows |
|---|---|---|---|---|
| Matched generation A | passes | 0 | 0 | 0 |
| Matched generation B | passes | 2 | 2 | 2 |
| B + A index; equal mtime | passes | 2 | 0 | 2 |
| B + A index; newer index | passes | 2 | 0 | 2 |
| B + A index; older index | passes | 2 | 0 | 2 |
| B + rebuilt index | passes | 2 | 2 | 2 |
| B with damaged CRC | rejected | 2 | error | error |
Several plausible checks passed on the wrong pair. Full decompression returned all three correct records, name listing returned both expected sequences, and a broad chr1 query and unchanged chr2 query returned their expected rows. Both the narrow command-line query and indexed -R query omitted the two moved records. Rebuilding the index from unchanged B data restored both narrow answers.
An older index timestamp produced a warning but did not change the successful exit status. Equal or newer stale timestamps produced no diagnostic. The inspected HTSlib implementation warns on an older local index and can finish an iterator when no indexed bins overlap. This source explanation is not a physical I/O trace. A deliberately damaged data-block CRC was rejected by the payload-reading controls, distinguishing a mismatched index from a missing CRC check.
The sequential control has a boundary too. -T found the two records here, but the inspected text-query path still loads index metadata. Our fixture preserves sequence names and parsing conventions; this is not a general index-free recovery method. Other mismatches may produce errors rather than silent omission. [Text-query source]
Method and limits: fourteen configurations, nine operations each, repeated twice per release produced 504 retained observations. A fresh replay of both native builds added 252 operations with matching outcomes. All used one host and tiny invented inputs. This is neither real genomic evidence, an incidence estimate, a performance benchmark, a new vulnerability nor independent peer review. The original paper's retrieval benchmarks do not establish this fault result.
Engineering implication: validate data/index agreement before binding both digests and coordinate conventions in a retained generation. Broad queries can miss this problem; use changed-region controls and a separately interpreted sequential reference. Neither a matching pair of checksums nor a manifest created from the wrong pair establishes the intended relationship.
Inspect the generated table and capture hashes, method, limits and reproduction guide, or complete code and evidence package. The package retains the original four captures, two fresh replays, complete command output, fixture bytes, source/build provenance and regression tests. Reproduction checks include executable hashes, not just reported version strings.
Pipefail reports failure; it does not roll back output
Streaming decompression can deliver output before the frame has finished. The Zstandard streaming API distinguishes produced bytes from a completed frame; Bash separately defines how pipeline commands contribute to the final exit status. Neither contract makes a downstream write transactional. [Streaming API] [Bash pipeline status]
We tested four synthetic inputs through three paths: zstd -d -c --check | tee destination, the same pipeline with pipefail, and decoding into a private staging file. Each destination initially held a known previous generation. The staging path replaced it only after decoder success and agreement with the original full payload's length and SHA-256.
| Input | Emitted bytes | Decoder exit | Default / pipefail exit | Staging decision |
|---|---|---|---|---|
| Both frames complete | 1,048,599 | 0 | 0 / 0 | Accept; replace previous |
| First checksum damaged | 1,048,570 | 1 | 0 / 1 | Reject; preserve previous |
| Final byte removed | 1,048,599 | 1 | 0 / 1 | Reject; preserve previous |
| Last frame removed | 1,048,576 | 0 | 0 / 0 | Reject; preserve previous |
The checksum-only mutation still wrote 1,048,570 bytes. The decoder exited 1, while tee exited 0. Default Bash therefore reported pipeline success. Enabling pipefail changed the pipeline status to 1, but the destination still contained those emitted bytes. The mutation changed a checksum, not the data blocks; this count is a build-specific observation, not a promised buffering threshold.
Two different gates catch two different failures. Removing the final byte produced all 1,048,599 expected bytes, yet the decoder failed: a hash alone was insufficient. Removing the complete last frame made both pipelines exit zero, but left out 23 bytes: status alone was insufficient. Staging preserved the previous destination for both cases and the damaged checksum, while the complete control was accepted.
Application inference: defer visible publication until the producer status and independently retained expectations both pass. A database import may need a transaction or an equivalent staging-and-commit mechanism; this file experiment does not test a database. A prior test followed by rereading a mutable input also needs an identity guarantee between those reads.
Our staging example uses a private same-directory file and os.replace. Successful replacement provides atomic name replacement on POSIX, not proof of persistence after power loss. We did not call fsync, inject crashes, test concurrent writers or accept untrusted archives. Production recovery also needs resource limits, metadata handling and a durability protocol appropriate to its filesystem. See the separate publication and rename analysis. [Atomic replacement]
Research context: Pillai and colleagues separate atomicity, ordering and durability in their OSDI 2014 study. Their ALICE framework explores crash states from application traces; its findings depend on the modeled persistence properties and tested workloads. In particular, persisting file contents does not by itself persist the directory operation that publishes their name. This is historical crash-consistency evidence, not a Zstandard test or a guarantee about current filesystems. Our staging experiment establishes acceptance before replacement during normal execution, not durable recovery after a crash. [OSDI 2014, sections 2.2, 3.2-3.6 and 4.4]
Reproduce with the output-publication harness and compare the 12 raw observations:
python3 zstd-output-publication.py --output publication.jsonMeasured: *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***; GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu); tee (GNU coreutils) 9.4; Python 3.12.3. Only synthetic files in a temporary directory are modified. These are deterministic contract demonstrations, not failure frequencies or a new codec vulnerability.
A stronger restore acceptance rule
Saltzer, Reed and Clark's 1984 paper End-to-End Arguments in System Design explains why reliable intermediate steps cannot replace the application's final check. Its file-transfer example reads back the destination and compares it with an expectation retained at the source; lower-level checks still help avoid expensive retries. This is a design argument, not an archive benchmark. Our application to these controls is narrower: a restore gate must establish the intended content, coverage and error propagation together. We have not reproduced the paper's network example or tested crash durability. [End-to-end paper]
The following checklist is Hesela's engineering inference from the experiment, not a universal archival standard. A trusted manifest should describe the intended object generation and complete content, not be reconstructed from the damaged input during the restore.
- Retain the exact dictionary bytes and bind them to the archive by a cryptographic digest, alongside decoder version, options and required runtime. A short dictionary ID is a lookup hint, not a replacement for that evidence.
- Verify expected compressed-object identity before decoding, then verify the full decoded length and digest against independently retained expectations. Protect the manifest itself if malicious replacement is in scope.
- Record and test the decoder checksum policy, including a known-bad-checksum control. Require successful validation through the decoder's terminal state as well as matching output; test that failures reach the calling automation, not just its log. Do not publish partial output from a failed restore as a valid recovered object.
- Specify which archive member is intended, including duplicate-name policy or an explicit occurrence. Test the same output mode used in recovery; disk and stdout extraction can select different bytes. Verify the intended coverage too: selecting one member or listing names does not check every payload.
- Set decoder-window, cumulative-output and time budgets independently. Keep recovered output provisional until all validation succeeds; do not infer an output quota from the decoder memory option.
- Test in an isolated environment without relying on a production dictionary cache. Check application-level usability after decoding; matching bytes alone does not prove the recovered system works.
This extends the distinction in backup verification versus restore testing and the identity limits of checksums.
Reproduce without touching stored data
Download the Python harness and inspect the raw JSON observations. Python's standard library and an installed zstd CLI are sufficient:
python3 zstd-archive-contract.py --output observations.jsonFor the eight formatted-dictionary cases, use the separate identity harness and identity observations:
python3 zstd-dictionary-identity.py --output identity.jsonThat runner records training parameters, the length-delimited training-corpus hash, all dictionary variants, payload hashes and frame IDs. It uses one training thread and a 30-second limit per subprocess. Its measured environment is *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***, Python 3.12.3, Linux x86_64. Repeated observations matched on this build; identical trained bytes across different versions are not promised.
The original runner creates private temporary dictionaries, sends bounded synthetic inputs through pipes and limits each subprocess to 15 seconds. It compares complete output bytes directly; published hashes make those comparisons independently inspectable. Runtime checks remain active under Python optimization. No existing data files are used as test inputs.
The resource-limit supplement has a separate four-case Python harness and JSON result. It generates at most 4 MiB of expected output per decode, uses a 15-second subprocess timeout, and records commands, hashes and frame settings. Its in-memory output capture is not a security limit: the script accepts no external archive input and must not be repurposed for untrusted inputs without an enforced output budget.
python3 zstd-resource-budgets.py --output resource-observations.jsonSupplement environment: *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***, Python 3.12.3, Linux x86_64. No peak RSS, CPU cost, throughput or HTTP content-coding behavior was measured.
Measured environment: *** Zstandard CLI (64-bit) v1.5.5, by Yann Collet ***, Python 3.12.3, Linux x86_64. Documentation is pinned separately to Zstandard 1.5.7. The fourteen cases are deterministic demonstrations on one build, not fourteen independent reliability trials. They do not establish corruption frequencies, performance, power-loss behavior or general guarantees for other libraries.
Primary sources
- python-zstandard 0.25.0: one-shot and incremental decompression APIs
- python-zstandard 0.25.0 pinned C extension: Decompressor_decompress allocation, resize and empty-frame branches
- python-zstandard 0.25.0 pinned CFFI backend: ZstdDecompressor.decompress
- Janos Falucskai: On equivalence of two tests for codes, 2008, section 1, pp. 249-250
- Janos Falucskai: A novel test for unique decipherability of codes, 2011, pp. 535-537
- Cassaigne and Nicolas: On the decidability of semigroup freeness, arXiv:0808.3112v4, definitions and examples in section 1.1
- Brockway McMillan (1956): Two Inequalities Implied by Unique Decipherability, IRE Transactions on Information Theory 2(4), 115-116
- Bryan Ford: VXA: A Virtual Architecture for Durable Compressed Archives, FAST 2005, sections 2 and 5
- RFC 8878: Zstandard Compression, sections 2, 3, 3.1.1, 3.1.2 and 5
- Zstandard v1.5.7 CLI manual: dictionaries, checksums and dictionary-ID omission
- Zstandard v1.5.7 API manual: dictionary identification and decompression
- Zstandard seekable format 0.1.0, pinned to v1.5.7
- GNU tar 1.35: appending files and repeated member names
- GNU tar 1.35: Writing to Standard Output
- GNU tar 1.35: --occurrence and early completion
- Python 3.12 tarfile: getmember, getmembers and extractfile
- GNU tar 1.35: Basic Tar Format, header checksum coverage
- RFC 1952: GZIP file format specification 4.3, sections 2.2, 2.3.1 and 2.3.1.2
- Python 3.12 gzip documentation: multi-member decompression and errors
- Python 3.12 zlib documentation: eof, unused_data and unconsumed_tail
- CPython v3.12.3 gzip.py: GzipFile.close and _GzipReader._read_eof
- zlib v1.3 public interface: inflate stops at a gzip member boundary
- Python 3.12 zipfile: ZipInfo selection, testzip and command-line testing
- CPython v3.12.3 zipfile implementation: testzip, NameToInfo and CLI main
- CPython issue 156539: testzip skips earlier duplicate members (reported August 2026)
- PKWARE ZIP APPNOTE: local headers, central directory and CRC fields, sections 4.3.7 and 4.3.12
- Saltzer, Reed and Clark: End-to-End Arguments in System Design, ACM TOCS 2(4), 1984
- GNU tar 1.35: Ignoring Blocks of Zeros
- GNU tar 1.35: Combining Archives with --concatenate
- GNU gzip: Advanced usage, concatenated members
- Python 3.12 TarFile: ignore_zeros and salvage behavior
- CPython v3.12.3: TarFile.next header handling
- RFC 8493: BagIt 1.0, complete and valid bags (section 3), security (5.4)
- Elizabeth D. Zwicky: Further Torture: More Testing of Backup and Archive Programs, LISA 2003
- GNU tar 1.35: Hard Links, section 8.3.3
- CPython v3.12.15: extractfile, makelink_with_filter and _find_link_target
- GNU tar 1.35: Keep Old Files
- Zstandard v1.5.7 reference seekable decoder: range completion and checksum checks
- Zstandard v1.5.7 seekable API: read semantics and source lifetime
- Hesela: native seekable-decoder observations, source fingerprints and reproduction
- Bairavasundaram et al.: An Analysis of Data Corruption in the Storage Stack, FAST 2008, sections 2.2-2.3
- XZ v5.4.5 list.c: parse_check_value and parse_details
- XZ v5.4.5 manual: test/list modes, data-check policy and --ignore-check
- XZ format 1.1.0: stream structure, Block Check and Index
- XZ v5.4.5 liblzma container API: absent/unsupported check notifications
- Zhang et al.: End-to-end Data Integrity for File Systems: A ZFS Case Study, FAST 2010
- XZ for Java 1.10: SingleXZInputStream completion and pending-exception contract
- XZ for Java 1.10: XZInputStream concatenation and input-end handling
- GNU tar 1.35: Using tar to Perform Incremental Dumps, section 5.2
- GNU tar 1.35: Dumpdir control codes and omitted payloads
- Maheshwari, Vingralek and Shapiro: How to Build a Trusted Database System on Untrusted Storage, OSDI 2000, sections 6.2-6.3
- Linux v6.8 initramfs format: c_magic and c_chksum
- libarchive v3.7.2 cpio(5): New CRC Format and Bugs
- GNU cpio 2.15 source: copyin.c lines 523-545 and 1561-1568; paxexit*.c
- GNU cpio manual: --only-verify-crc
- libarchive v3.7.2 CPIO reader: format detection, header_newc and read_data
- Linux v6.8 initramfs.c: do_header, xwrite and do_copy
- SAM/BAM specification: BGZF framing and virtual offsets, section 4.1
- HTSlib 1.24 bgzip manual: GZI offset pairs, integrity testing and recompression
- Heng Li. Tabix: fast retrieval of sequence features from generic TAB-delimited files. Bioinformatics 27(5), 718-719 (2011).
- HTSlib 1.24 tabix manual: coordinate conventions, TBI limit and CSI selection
- The Tabix index file format: fields, coordinate flag and chunk offsets
- CSI version 1: configurable binning geometry and auxiliary metadata
- HTSlib 1.24 hts.c: index timestamps and interval iterators
- HTSlib 1.24 tabix.c: text queries still load index metadata
- MITRE CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)
- GNU Bash reference manual: Pipelines (also checked against the installed Bash 5.2 manual)
- Zstandard v1.5.5 public API: streaming decompression, output positions and completion
- Python 3.12 os.replace: same-filesystem atomic replacement semantics
- Pillai et al.: All File Systems Are Not Created Equal, OSDI 2014, sections 2.2, 3.2-3.6 and 4.4
- Xiph libFLAC decoder API: configured MD5 flag, seek/reset and finish
- libFLAC 1.4.3 pinned decoder contract: setting getter versus active checking
- RFC 9639: FLAC sample MD5 and channel-mask interpretation, sections 8.2 and 8.6.2
- Xiph FLAC CLI manual: test mode and warnings-as-errors
- Maxino and Koopman (2009): The Effectiveness of Checksums for Embedded Control Networks, sections 3 and 3.5; DOI 10.1109/TDSC.2007.70216
- RFC 1950: zlib DICTID, decoded Adler-32 and checksum recurrence, sections 2.2 and 9
- RFC 1951: DEFLATE reversibility, blocks and encoding choices, sections 1.1, 2, 3.2-3.3 and 4
- zlib 1.3.1 manual: deflateSetDictionary and inflateSetDictionary
- zlib v1.3 inflate.c: FLAGS and HCRC checks
- zlib v1.3 gzread.c: transparent input and gzip member transitions
- Ziv and Lempel (1977): A Universal Algorithm for Sequential Data Compression, introduction
- Claude E. Shannon, A Mathematical Theory of Communication (1948), sections 9-10; corrected reprint
- Jarek Duda: Asymmetric numeral systems, arXiv:1311.2540v2 (2014), sections 2.3, 3.7 and 4
- Zstandard v1.5.7 format: entropy coding and sequence compression modes
- Sebastiano Vigna, Quasi-Succinct Indices, WSDM 2013, sections 4-7; DOI 10.1145/2433396.2433409
- Giuseppe Ottaviano and Rossano Venturini, Partitioned Elias-Fano Indexes, SIGIR 2014, sections 4-5; DOI 10.1145/2600428.2609615
- Apache Parquet: hybrid RLE/bit-packing encodings
- Apache Arrow: columnar Boolean buffers and alignment
- Melnik et al., Dremel: Interactive Analysis of Web-Scale Datasets, PVLDB 3(1), 2010, sections 4.1-4.3
- RFC 9639: FLAC residual coding, sections 4.4 and 9.2.7
- David A. Huffman (1952), A Method for the Construction of Minimum-Redundancy Codes, Proceedings of the IRE 40(9), 1098-1101; DOI 10.1109/JRPROC.1952.273898
- Lemire and Boytsov: Decoding billions of integers per second through vectorization, sections 2.6-2.8 and 5
- Apache Parquet: DELTA_BINARY_PACKED encoding and reconstruction context
- Zukowski, Heman, Nes and Boncz: Super-Scalar RAM-CPU Cache Compression, ICDE 2006, sections 2.1 and 3.1
- Claude E. Shannon: A Mathematical Theory of Communication (1948), sections 6 and 9, Theorem 9
- Ian H. Witten, Radford M. Neal and John G. Cleary: Arithmetic Coding for Data Compression, CACM 30(6), 520-540 (1987), DOI 10.1145/214762.214771
- RFC 6716: Definition of the Opus Audio Codec, sections 4.1 and 5.1.5, range coding and finalization
- Drmota, Reznik, Savari and Szpankowski: Precise Asymptotic Analysis of the Tunstall Code, ISIT 2006, sections I-II
- Ziv and Lempel (1978): Compression of Individual Sequences via Variable-Rate Coding, pp. 530-536
- Welch (1984): A Technique for High-Performance Data Compression, pp. 8-19
- CompuServe GIF89a: Appendix F and deferred-clear clarification
- Aldus TIFF Revision 6.0 (1992): sections 13-14, LZW compression and differencing predictor
- LZ4 v1.10.0: block format, LZ77-type byte-oriented encoding, offset limits and out-of-band metadata.
- Huang et al. Towards Condensed and Efficient Read-Only File System via Sort-Enhanced Compression. FAST 2026, pp. 35-51; sections 4-6.
- RFC 3309: SCTP Checksum Change, section 1 (September 2002)
- Jonathan Stone and Craig Partridge: When The CRC and TCP Checksum Disagree, SIGCOMM 2000, section 6, pp. 317-318
- GNU gzip 1.14 release: multi-member listing fix (9 April 2025)
- GNU gzip 1.14 release source: gzip.c, unzip.c, NEWS, tests/list and doc/gzip.texi
- Hesela: ZIP extraction failure states, retained captures and reproducibility package
- CPython v3.12.3 shutil: copyfileobj and COPY_BUFSIZE
- Pillai et al., All File Systems Are Not Created Equal (OSDI 2014), sections 3 and 4.4
Codec sources checked 17 October 2026; TAR, gzip, ZIP and Python sources checked 18 October 2026. TAR boundary and continuation sources checked 21 October 2026; hard-link sources reviewed 22 October 2026; seekable-format sources and retained native evidence reviewed 23 October 2026; XZ sources and FAST 2010 lifecycle analysis reviewed 24 October 2026. NPY/NPZ cross-reference checked 24 October 2026. CPIO sources and native replay checked 25 October 2026. BGZF/tabix sources reviewed 25 October 2026. All test data are synthetic; no external dataset is redistributed.