Expand description
The bzip2 / bunzip2 / bzcat family: stuffr behaving as bzip2 1.0.8.
Ported from bzip2 1.0.8’s bzip2.c, copyright (C) 1996-2019 Julian R
Seward, under the bzip2 licence reproduced in LICENSE-bzip2. Its flag
handling, checks, messages and exit codes are followed line by line; the
compression itself is stuffr’s bzip2 codec, whose output is byte-identical
to bzip2’s at every level. In file-to-file mode SIGINT, SIGTERM and SIGHUP
are caught (even if inherited as ignored, as bzip2’s signal() does) and
answered at the next chunk with bzip2’s message and cleanUpAndFail(1).
Known deviations from bzip2 1.0.8:
--version/-V/-L/--licensename stuffr and its version on the licence’s first line (the rest is verbatim).- Verbosity 2 and above (
-vv) behaves as-v: libbzip2’s internal trace (block CRCs, sorting statistics) is not reachable through stuffr’s codec API, and bzip2.c’s own extra blank lines at that level only frame that trace, so they are left out with it. - In file-to-file mode with
-freading a FIFO or terminal, an interrupt is answered once the blocked read returns, where bzip2 answers at once: stuffr’s handlers only set a flag that the read loops poll, and they restart an interrupted read. - When the parent ignores
SIGPIPE(SIG_IGNinherited across exec), bzip2 reports a Broken pipe I/O error and exits 1; stuffr dies ofSIGPIPE, because the Rust runtime setsSIG_IGNbeforemainand the inherited disposition cannot be read on stable Rust. - The
perrortext after a cut-short stream reproduces theerrnothat bzip2 happens to leave behind as measured on macOS; elsewhere it printsstrerror(0).
Functions§
- run
- Entry point for
bzip2,bunzip2andbzcat;nameis the canonical invoked name andargsthe arguments afterargv[0].