Skip to content

Use native sequential archive input for TAR and CPIO - #380

Merged
Hawkynt merged 3 commits into
mainfrom
feat/native-sequential-archive-input
Sep 21, 2026
Merged

Hawkynt merged 3 commits into
mainfrom
feat/native-sequential-archive-input

Conversation

@Hawkynt

@Hawkynt Hawkynt commented Sep 21, 2026

Copy link
Copy Markdown
Owner

What changed

  • Override the universal forward-only archive input surface for TAR and CPIO using their existing sequential readers.
  • Keep the overrides explicit on IArchiveFormatOperations, so concrete descriptor public API/documentation does not grow just to specialize a default interface member.
  • Rewind seekable callers for semantic parity with the default adapter, while non-seekable callers are consumed directly.
  • Add regression tests that append trailing junk and prove the source is not fully read/spooled before parsing.
  • Add a TAR single-entry test proving OpenEntryStreaming can return the first entry without consuming the remainder of the archive.

Why these formats

POSIX ustar/pax is intrinsically sequential: a 512-byte header is followed by that entry's data blocks, with two zero blocks terminating the archive. CPIO is likewise a sequence of header, pathname, payload records ending at TRAILER!!!. Their existing readers already support non-seekable sources, so the generic temporary-file compatibility spool added by #373 is unnecessary overhead for these formats.

AR was reviewed but deliberately not changed: the current reader materializes ordinary members and depends on seeking for oversized members, so a native streaming override would not yet be uniformly safe.

Reference material

  • POSIX pax/ustar interchange description: header followed by file data records and two 512-byte zero terminators.
  • POSIX/FreeBSD cpio format descriptions: sequential header/name/data entries terminated by TRAILER!!!.
  • libarchive read API architecture: streamable TAR/CPIO-style readers can operate without a seek callback; seekability remains a separate capability.

No external source code was copied or translated. No new dependencies were introduced.

Validation

  • Branch is based on current main at 7bf197676b1a33039caaddb9f79da27ffdb7328c.
  • Full CI pending.

@Hawkynt
Hawkynt merged commit e5e1e22 into main Sep 21, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant