feat(format): CAB and XAR read-only seek providers [RM-305]#68
Merged
P4suta merged 2 commits intoJul 23, 2026
Merged
Conversation
Add arca's first read-only built-in seek-native formats: Microsoft Cabinet (CAB) and eXtensible ARchive (XAR). Both decode through the always-on miniz_oxide codec, so they need no feature gate and stay pure-Rust / C-free on the portable profile. Registration: FormatId::Cab / FormatId::Xar with MSCF / xar! probe signatures (core format.rs); decode-only capability FormatCapabilities::new(true, false, true) and format_name (provider.rs); a SeekDispatch::Cab / ::Xar arm + signature detection in SeekArchiveReader::open (seek_stream.rs); mod cab / mod xar (lib.rs). Write is rejected without a bespoke path: the decode-only capability yields a typed Capability error and SeekArchiveWriter falls through to Unsupported. CAB (cab.rs): bounded MSCF parser — CFHEADER (with optional reserve + prev/next strings), CFFOLDER / CFFILE tables, per-folder CFDATA blocks, all within Limits. A folder is decoded one block at a time (no whole folder materialised). Store copies through; MSZIP verifies the CK magic and inflates each block's raw DEFLATE while carrying the folder's 32 KiB LZ77 window across blocks via a fresh DecompressorOxide over a preserved wrapping ring. QUANTUM/LZX/cross-cabinet-continuation/spanning blocks list metadata then surface structured Unsupported. XAR (xar.rs): big-endian header locates the zlib TOC (inflated bounded by metadata_bytes, length-verified) and the heap (heap_start = header.size + toc_length_compressed). A hand-rolled bounded XML pull-scanner (DFS <file>-frame stack, no DOM/xml crate) resolves each entry's /-joined path, emitting directories before children. Regular files stream their heap blob per entry as stored or zlib (x-gzip = RFC-1950, decoded as zlib not gzip), decoded length verified. x-bzip2 and unknown encodings are structured Unsupported; version != 1 is Unsupported. Tests: interop_cab_meta.rs / interop_xar_meta.rs build valid archives with first-party in-code raw builders (independent DEFLATE/zlib via flate2, re-inflated by miniz_oxide), read them back through the RM-301 harness, and assert content round trips plus unsupported-method and truncated-header structured-error negatives. A three-lens adversarial review with a verification pass ran over both modules; its one confirmed finding — XAR <ea> extended-attribute children overwriting a file's <data>/<name> — is fixed here (scope the pull-scanner to ignore <ea> leaf capture) with a regression test. forbid(unsafe)/no-dyn/bounded hold; no new dependency. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…scope prose and unioning evidence
P4suta
enabled auto-merge (squash)
July 23, 2026 03:53
P4suta
deleted the
feature/dev-111-rm-305-cab-and-xar-read-only-providers
branch
July 23, 2026 04:08
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.
RM-305 / DEV-111 — CAB and XAR read-only providers
arca's first read-only built-in seek-native formats: Microsoft Cabinet (CAB) and eXtensible ARchive (XAR). Both decode through the always-on
miniz_oxidecodec, so they need no feature gate and stay pure-Rust / C-free on the portable profile.Registration
FormatId::Cab/FormatId::XarwithMSCF/xar!probe signatures (coreformat.rs); decode-onlyFormatCapabilities::new(true, false, true)+format_name(provider.rs); aSeekDispatch::Cab/::Xararm + signature detection inSeekArchiveReader::open(seek_stream.rs);mod cab/mod xar(lib.rs). Write is rejected without a bespoke path — the decode-only capability yields a typedCapabilityerror andSeekArchiveWriterfalls through toUnsupported.CAB (
cab.rs)Bounded MSCF parser:
CFHEADER(optional reserve + prev/next strings),CFFOLDER/CFFILEtables, per-folderCFDATAblocks, all withinLimits; a folder decoded one block at a time (no whole folder materialised). Store copies through; MSZIP verifies theCKmagic and inflates each block's raw DEFLATE while carrying the folder's 32 KiB LZ77 window across blocks via a freshDecompressorOxideover a preserved wrapping ring. QUANTUM/LZX/cross-cabinet-continuation/spanning → structuredUnsupported.XAR (
xar.rs)Big-endian header locates the zlib TOC (inflated bounded by
metadata_bytes, length-verified) and the heap (heap_start = header.size + toc_length_compressed). A hand-rolled bounded XML pull-scanner (DFS<file>-frame stack, no DOM / no XML crate) resolves each entry's/-joined path, emitting directories before children. Regular files stream their heap blob per entry as stored or zlib (x-gzip= RFC-1950, decoded as zlib not gzip), decoded length verified.x-bzip2/ unknown encodings / version ≠ 1 → structuredUnsupported.Tests & review
interop_cab_meta.rs/interop_xar_meta.rs: first-party in-code raw builders (independent DEFLATE/zlib viaflate2, re-inflated byminiz_oxide→ codec independence) read back through the RM-301 harness; content round trips + unsupported-method and truncated/out-of-range-header structured-error negatives.<ea>extended-attribute children overwriting a file's<data>/<name>(silent mis-read of valid macOS xars) — is fixed here (scope the scanner to ignore<ea>leaf capture) with a regression test. Minor findings (MSZIP wrapping-ring over-far-distance behaviour) are documented in the module.forbid(unsafe)/ no-dyn / bounded hold; no new dependency.just cipassed locally.🤖 Generated with Claude Code