Close libarchive archive/filter parity gaps - #374
Merged
Merged
Conversation
Hawkynt
force-pushed
the
feature/libarchive-parity
branch
3 times, most recently
from
September 19, 2026 01:40
3a5981b to
75ba219
Compare
…her number The header mode was written as `0644` and masked with `0777`. C# has no octal literal, so those are the decimal numbers 644 and 777: the mask cleared bits that belong to the permission field and the default was never 0644 at all. `begin-base64` came out carrying "1000" for the default and "400" for a requested 0600, which is not a mode bsdtar will accept. The permission mask and the default are now named constants written in hex, with the octal value they stand for stated next to them, so the two notations cannot be confused again. The round-trip test asked for `0600` and expected `0600` back, which held only while both ends were wrong in the same way; it now pins the header text as well as the value.
…ores Every conversion target so far could also be extracted, so the matrix verified a conversion by reading the payload back. mtree is the first target that records metadata and no file bodies, and the matrix read the absent payload as a broken conversion rather than as the format's own shape. Payload comparison is now skipped for a target that does not advertise CanExtract. The conversion still runs and the manifest is still re-listed and checked for the expected entry names, so the pair keeps its coverage instead of being excluded from the grid.
The generated reference prints a signature and its summary, so the mode default now reads as the number it is. Both encoder summaries say which octal value that number stands for, rather than leaving a bare 420 in the table.
Hawkynt
force-pushed
the
feature/libarchive-parity
branch
from
September 19, 2026 02:18
75ba219 to
fb8a443
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Two libarchive formats CWB did not have:
mtree(5)manifest reader, writer and registry descriptor. mtree is treated as what it is — a metadata manifest with no embedded file bodies — so the descriptor advertises list/create/test and not extract, and CWB never dereferences acontents=host path out of an untrusted manifest.begin-base64/====wrapper asB64Encoding, libarchive'sb64encodefilter: streaming 57-byte input blocks, canonical 76-character lines, and name/mode options.The CPIO half of the original branch has been dropped.
Read and write every historical cpio header variant(#376) landed all four header variants on main first, with a sharedCpioLayout, verifiedcrcchecksums, variant-preserving edits and a larger test set. This branch no longer touches any CPIO file.Fixes made while rebasing
0644and0777are decimal literals in C#, not octal, so the mask cleared permission bits and the default was never 0644: the header carried1000by default and400for a requested 0600. The mask and default are now named constants written in hex alongside the octal value they stand for.begin 1204. libarchive rejects that header outright (Unrecognized archive format) and accepts thebegin 644now emitted, so this was an interoperability defect rather than a cosmetic one.CanExtract; the conversion still runs and the manifest is still re-listed and checked for the expected entry names. mtree is the only descriptor in the repository this applies to.Not included
PWB/UNIX binary CPIO is deliberately left out. It is byte-identical to the little-endian 7th Edition variant, so the original branch detected it with a mode-bit heuristic that latched for the remainder of the archive and rewrote mode bits once it fired. Placing that in front of binary CPIO reads which #376 validated against
bsdcpioand GNU cpio risks changing archives that read correctly today. If PWB is wanted, an explicit write option plus an explicit read override — the shape libarchive itself uses — is the safe design, and belongs in its own change.Validation
bsdtar/bsdcpio(libarchive 3.8.9) run as real oracles in both directions for the wrapper and for mtree.ArchivesReadmeStateTests.References
mtree(5)b64encodefilter and its published test vector