Expand description
Shared library for the ox* CLI tools (oxtar/oxcpio/oxcat/oxunzip).
Each [[bin]] is a thin main that forwards to a run_* entry point here and maps the
returned CliError onto the unified exit-code contract:
- 0 — success.
- 1 — runtime failure (I/O error, corrupt archive, decompression-bomb cap hit).
- 2 — usage error (bad/unknown/unsupported flag, missing operand).
The tools mirror the de-facto bsdtar/bsdcpio/bsdcat/bsdunzip interfaces and reuse the
flagship library’s logic wholesale (auto-detecting reader, extract, the create/build
functions, and decompress). Classic flags the library cannot honor faithfully are not
silently stubbed: they return a clear unsupported: <flag> usage error (exit 2) and are
documented in each tool’s --help.
§Safe defaults (an intentional, documented divergence from historical tar)
Unlike classic tar, these tools keep two safety nets on by default, because the library is
designed to consume untrusted archives:
- Path-traversal rejection: entries whose sanitized path escapes the destination (
../, absolute paths, Windows drive/UNC prefixes) are refused, vialibarchive_oxide::sanitize. - Decompression-bomb cap: transparent decompression is capped at
MAX_DECOMPRESSEDbytes.
Re-exports§
Modules§
- cat
oxcat— the bsdcat-compatible transparent decompressor.- cpio
oxcpio— the bsdcpio-compatible cpio interface over the flagship library.- tar
oxtar— the bsdtar-compatible tar interface over the flagship library.- unzip
oxunzip— the bsdunzip-compatible zip extractor over the flagship library.
Structs§
- CliError
- A CLI failure carrying the exit code it maps to.
Constants§
- MAX_
DECOMPRESSED - Cap on decompressed size for untrusted input (defends against decompression bombs).
Functions§
- decompress_
cap - The decompression-bomb cap as a
usize(clamped on 32-bit targets).
Type Aliases§
- CliResult
- Convenience alias for CLI entry points.