1
0
Fork 0

Merging upstream version 1.12~rc1.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-24 04:19:50 +01:00
parent 4ddb634c25
commit cd6a248630
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
24 changed files with 874 additions and 719 deletions

View file

@ -6,8 +6,8 @@
@finalout
@c %**end of header
@set UPDATED 21 January 2024
@set VERSION 1.11
@set UPDATED 19 November 2024
@set VERSION 1.12-rc1
@dircategory Compression
@direntry
@ -36,17 +36,18 @@
This manual is for Plzip (version @value{VERSION}, @value{UPDATED}).
@menu
* Introduction:: Purpose and features of plzip
* Output:: Meaning of plzip's output
* Invoking plzip:: Command-line interface
* Program design:: Internal structure of plzip
* Memory requirements:: Memory required to compress and decompress
* Minimum file sizes:: Minimum file sizes required for full speed
* File format:: Detailed format of the compressed file
* Trailing data:: Extra data appended to the file
* Examples:: A small tutorial with examples
* Problems:: Reporting bugs
* Concept index:: Index of concepts
* Introduction:: Purpose and features of plzip
* Output:: Meaning of plzip's output
* Invoking plzip:: Command-line interface
* Argument syntax:: By convention, options start with a hyphen
* File format:: Detailed format of the compressed file
* Program design:: Internal structure of plzip
* Memory requirements:: Memory required to compress and decompress
* Minimum file sizes:: Minimum file sizes required for full speed
* Trailing data:: Extra data appended to the file
* Examples:: A small tutorial with examples
* Problems:: Reporting bugs
* Concept index:: Index of concepts
@end menu
@sp 1
@ -61,30 +62,29 @@ distribute, and modify it.
@chapter Introduction
@cindex introduction
@uref{http://www.nongnu.org/lzip/plzip.html,,Plzip}
is a massively parallel (multi-threaded) implementation of lzip,
compatible with lzip 1.4 or newer. Plzip uses the compression library
@uref{http://www.nongnu.org/lzip/plzip.html,,Plzip} is a massively parallel
(multi-threaded) implementation of lzip. Plzip uses the compression library
@uref{http://www.nongnu.org/lzip/lzlib.html,,lzlib}.
@uref{http://www.nongnu.org/lzip/lzip.html,,Lzip}
is a lossless data compressor with a user interface similar to the one
of gzip or bzip2. Lzip uses a simplified form of the 'Lempel-Ziv-Markov
chain-Algorithm' (LZMA) stream format to maximize interoperability. The
maximum dictionary size is 512 MiB so that any lzip file can be decompressed
on 32-bit machines. Lzip provides accurate and robust 3-factor integrity
checking. Lzip can compress about as fast as gzip @w{(lzip -0)} or compress most
files more than bzip2 @w{(lzip -9)}. Decompression speed is intermediate between
gzip and bzip2. Lzip is better than gzip and bzip2 from a data recovery
perspective. Lzip has been designed, written, and tested with great care to
replace gzip and bzip2 as the standard general-purpose compressed format for
Unix-like systems.
of gzip or bzip2. Lzip uses a simplified form of LZMA (Lempel-Ziv-Markov
chain-Algorithm) designed to achieve complete interoperability between
implementations. The maximum dictionary size is 512 MiB so that any lzip
file can be decompressed on 32-bit machines. Lzip provides accurate and
robust 3-factor integrity checking. @w{@samp{lzip -0}} compresses about as fast as
gzip, while @w{@samp{lzip -9}} compresses most files more than bzip2. Decompression
speed is intermediate between gzip and bzip2. Lzip provides better data
recovery capabilities than gzip and bzip2. Lzip has been designed, written,
and tested with great care to replace gzip and bzip2 as general-purpose
compressed format for Unix-like systems.
Plzip can compress/decompress large files on multiprocessor machines much
faster than lzip, at the cost of a slightly reduced compression ratio (0.4
to 2 percent larger compressed files). Note that the number of usable
threads is limited by file size; on files larger than a few GB plzip can use
hundreds of processors, but on files of only a few MB plzip is no faster
than lzip. @xref{Minimum file sizes}.
hundreds of processors, but on files smaller than @w{1 MiB} plzip is no faster
than lzip (even at compression level -0). @xref{Minimum file sizes}.
For creation and manipulation of compressed tar archives
@uref{http://www.nongnu.org/lzip/manual/tarlz_manual.html,,tarlz} can be more
@ -132,9 +132,9 @@ makes it safer than compressors returning ambiguous warning values (like
gzip) when it is used as a back end for other programs like tar or zutils.
Plzip automatically uses for each file the largest dictionary size that does
not exceed neither the file size nor the limit given. Keep in mind that the
decompression memory requirement is affected at compression time by the
choice of dictionary size limit. @xref{Memory requirements}.
not exceed neither the file size nor the limit given. The dictionary size
used for decompression is the same dictionary size used for compression.
@xref{Memory requirements}.
When compressing, plzip replaces every file given in the command line
with a compressed version of itself, with the name "original_name.lz".
@ -235,11 +235,8 @@ argument means standard input. It can be mixed with other @var{files} and is
read just once, the first time it appears in the command line. Remember to
prepend @file{./} to any file name beginning with a hyphen, or use @samp{--}.
plzip supports the following
@uref{http://www.nongnu.org/arg-parser/manual/arg_parser_manual.html#Argument-syntax,,options}:
@ifnothtml
@xref{Argument syntax,,,arg_parser}.
@end ifnothtml
@noindent
plzip supports the following options: @xref{Argument syntax}.
@table @code
@item -h
@ -286,7 +283,8 @@ already exists and @option{--force} has not been specified, plzip continues
decompressing the rest of the files and exits with error status 1. If a file
fails to decompress, or is a terminal, plzip exits immediately with error
status 2 without decompressing the rest of the files. A terminal is
considered an uncompressed file, and therefore invalid.
considered an uncompressed file, and therefore invalid. A multimember file
with one or more empty members is accepted if redirected to standard input.
@item -f
@itemx --force
@ -295,7 +293,7 @@ Force overwrite of output files.
@item -F
@itemx --recompress
When compressing, force re-compression of files whose name already has
the @samp{.lz} or @samp{.tlz} suffix.
the @file{.lz} or @file{.tlz} suffix.
@item -k
@itemx --keep
@ -309,7 +307,8 @@ even for multimember files. If more than one file is given, a final line
containing the cumulative sizes is printed. With @option{-v}, the dictionary
size, the number of members in the file, and the amount of trailing data (if
any) are also printed. With @option{-vv}, the positions and sizes of each
member in multimember files are also printed.
member in multimember files are also printed. A multimember file with one or
more empty members is accepted if redirected to standard input.
If any file is damaged, does not exist, can't be opened, or is not regular,
the final exit status is @w{> 0}. @option{-lq} can be used to check quickly
@ -327,7 +326,7 @@ times.
@item -n @var{n}
@itemx --threads=@var{n}
Set the maximum number of worker threads, overriding the system's default.
Valid values range from 1 to "as many as your system can support". If this
Valid values range from 1 to as many as your system can support. If this
option is not used, plzip tries to detect the number of processors in the
system and use it as default value. When compressing on a @w{32 bit} system,
plzip tries to limit the memory use to under @w{2.22 GiB} (4 worker threads
@ -353,10 +352,10 @@ to @option{-c}. @option{-o} has no effect when testing or listing.
In order to keep backward compatibility with plzip versions prior to 1.9,
when compressing from standard input and no other file names are given, the
extension @samp{.lz} is appended to @var{file} unless it already ends in
@samp{.lz} or @samp{.tlz}. This feature will be removed in a future version
extension @file{.lz} is appended to @var{file} unless it already ends in
@file{.lz} or @file{.tlz}. This feature will be removed in a future version
of plzip. Meanwhile, redirection may be used instead of @option{-o} to write
the compressed output to a file without the extension @samp{.lz} in its
the compressed output to a file without the extension @file{.lz} in its
name: @w{@samp{plzip < file > foo}}.
@item -q
@ -386,7 +385,8 @@ together with @option{-v} to see information about the files. If a file
fails the test, does not exist, can't be opened, or is a terminal, plzip
continues testing the rest of the files. A final diagnostic is shown at
verbosity level 1 or higher if any file fails the test when testing multiple
files.
files. A multimember file with one or more empty members is accepted if
redirected to standard input.
@item -v
@itemx --verbose
@ -416,7 +416,7 @@ given, the last setting is used. For example @w{@option{-9 -s64MiB}} is
equivalent to @w{@option{-s64MiB -m273}}
@multitable {Level} {Dictionary size (-s)} {Match length limit (-m)}
@item Level @tab Dictionary size (-s) @tab Match length limit (-m)
@headitem Level @tab Dictionary size (-s) @tab Match length limit (-m)
@item -0 @tab 64 KiB @tab 16 bytes
@item -1 @tab 1 MiB @tab 5 bytes
@item -2 @tab 1.5 MiB @tab 6 bytes
@ -437,7 +437,7 @@ Aliases for GNU gzip compatibility.
When decompressing, testing, or listing, allow trailing data whose first
bytes are so similar to the magic bytes of a lzip header that they can
be confused with a corrupt header. Use this option if a file triggers a
"corrupt header" error and the cause is not indeed a corrupt header.
'corrupt header' error and the cause is not indeed a corrupt header.
@item --in-slots=@var{n}
Number of @w{1 MiB} input packets buffered per worker thread when
@ -474,7 +474,7 @@ and may be followed by a multiplier and an optional @samp{B} for "byte".
Table of SI and binary prefixes (unit multipliers):
@multitable {Prefix} {kilobyte (10^3 = 1000)} {|} {Prefix} {kibibyte (2^10 = 1024)}
@item Prefix @tab Value @tab | @tab Prefix @tab Value
@headitem Prefix @tab Value @tab | @tab Prefix @tab Value
@item k @tab kilobyte (10^3 = 1000) @tab | @tab Ki @tab kibibyte (2^10 = 1024)
@item M @tab megabyte (10^6) @tab | @tab Mi @tab mebibyte (2^20)
@item G @tab gigabyte (10^9) @tab | @tab Gi @tab gibibyte (2^30)
@ -494,6 +494,148 @@ indicate a corrupt or invalid input file, 3 for an internal consistency
error (e.g., bug) which caused plzip to panic.
@node Argument syntax
@chapter Syntax of command-line arguments
@cindex argument syntax
POSIX recommends these conventions for command-line arguments.
@itemize @bullet
@item A command-line argument is an option if it begins with a hyphen
(@samp{-}).
@item Option names are single alphanumeric characters.
@item Certain options require an argument.
@item An option and its argument may or may not appear as separate tokens.
(In other words, the whitespace separating them is optional, unless the
argument is the empty string).
Thus, @w{@option{-o foo}} and @option{-ofoo} are equivalent.
@item One or more options without arguments, followed by at most one option
that takes an argument, may follow a hyphen in a single token.
Thus, @option{-abc} is equivalent to @w{@option{-a -b -c}}.
@item Options typically precede other non-option arguments.
@item The argument @samp{--} terminates all options; any following arguments
are treated as non-option arguments, even if they begin with a hyphen.
@item A token consisting of a single hyphen character is interpreted as an
ordinary non-option argument. By convention, it is used to specify standard
input, standard output, or a file named @samp{-}.
@end itemize
@noindent
GNU adds @dfn{long options} to these conventions:
@itemize @bullet
@item A long option consists of two hyphens (@samp{--}) followed by a name
made of alphanumeric characters and hyphens. Option names are typically one
to three words long, with hyphens to separate words. Abbreviations can be
used for the long option names as long as the abbreviations are unique.
@item A long option and its argument may or may not appear as separate
tokens. In the latter case they must be separated by an equal sign @samp{=}.
Thus, @w{@option{--foo bar}} and @option{--foo=bar} are equivalent.
@end itemize
@noindent
The syntax of options with an optional argument is
@option{-<short_option><argument>} (without whitespace), or
@option{--<long_option>=<argument>}.
@node File format
@chapter File format
@cindex file format
Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away.@*
--- Antoine de Saint-Exupery
In the diagram below, a box like this:
@verbatim
+---+
| | <-- the vertical bars might be missing
+---+
@end verbatim
represents one byte; a box like this:
@verbatim
+==============+
| |
+==============+
@end verbatim
represents a variable number of bytes.
@noindent
A lzip file consists of one or more independent "members" (compressed data
sets). The members simply appear one after another in the file, with no
additional information before, between, or after them. Each member can
encode in compressed form up to @w{16 EiB - 1 byte} of uncompressed data.
The size of a multimember file is unlimited. Empty members (data size = 0)
are not allowed in multimember files.
Each member has the following structure:
@verbatim
+--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ID string | VN | DS | LZMA stream | CRC32 | Data size | Member size |
+--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@end verbatim
All multibyte values are stored in little endian order.
@table @samp
@item ID string (the "magic" bytes)
A four byte string, identifying the lzip format, with the value "LZIP"
(0x4C, 0x5A, 0x49, 0x50).
@item VN (version number, 1 byte)
Just in case something needs to be modified in the future. 1 for now.
@anchor{coded-dict-size}
@item DS (coded dictionary size, 1 byte)
The dictionary size is calculated by taking a power of 2 (the base size)
and subtracting from it a fraction between 0/16 and 7/16 of the base size.@*
Bits 4-0 contain the base 2 logarithm of the base size (12 to 29).@*
Bits 7-5 contain the numerator of the fraction (0 to 7) to subtract
from the base size to obtain the dictionary size.@*
Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB@*
Valid values for dictionary size range from 4 KiB to 512 MiB.
@item LZMA stream
The LZMA stream, terminated by an 'End Of Stream' marker. Uses default values
for encoder properties.
@ifnothtml
@xref{Stream format,,,lzip},
@end ifnothtml
@ifhtml
See
@uref{http://www.nongnu.org/lzip/manual/lzip_manual.html#Stream-format,,Stream format}
@end ifhtml
for a complete description.
@item CRC32 (4 bytes)
Cyclic Redundancy Check (CRC) of the original uncompressed data.
@item Data size (8 bytes)
Size of the original uncompressed data.
@item Member size (8 bytes)
Total size of the member, including header and trailer. This field acts
as a distributed index, improves the checking of stream integrity, and
facilitates the safe recovery of undamaged members from multimember files.
Lzip limits the member size to @w{2 PiB} to prevent the data size field from
overflowing.
@end table
@node Program design
@chapter Internal structure of plzip
@cindex program design
@ -510,8 +652,8 @@ because lzip usually produces single-member files, which can't be
decompressed in parallel.
For each input file, a splitter thread and several worker threads are
created, acting the main thread as muxer (multiplexer) thread. A "packet
courier" takes care of data transfers among threads and limits the
created, acting the main thread as muxer (multiplexer) thread. A 'packet
courier' takes care of data transfers among threads and limits the
maximum number of data blocks (packets) being processed simultaneously.
The splitter reads data blocks from the input file, and distributes them
@ -587,7 +729,7 @@ The following table shows the memory required @strong{per thread} for
compression at a given level, using the default data size for each level:
@multitable {Level} {Memory required}
@item Level @tab Memory required
@headitem Level @tab Memory required
@item -0 @tab 4.875 MiB
@item -1 @tab 17.75 MiB
@item -2 @tab 26.625 MiB
@ -638,96 +780,6 @@ data size for each level:
@end multitable
@node File format
@chapter File format
@cindex file format
Perfection is reached, not when there is no longer anything to add, but
when there is no longer anything to take away.@*
--- Antoine de Saint-Exupery
@sp 1
In the diagram below, a box like this:
@verbatim
+---+
| | <-- the vertical bars might be missing
+---+
@end verbatim
represents one byte; a box like this:
@verbatim
+==============+
| |
+==============+
@end verbatim
represents a variable number of bytes.
@sp 1
A lzip file consists of one or more independent "members" (compressed data
sets). The members simply appear one after another in the file, with no
additional information before, between, or after them. Each member can
encode in compressed form up to @w{16 EiB - 1 byte} of uncompressed data.
The size of a multimember file is unlimited.
Each member has the following structure:
@verbatim
+--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ID string | VN | DS | LZMA stream | CRC32 | Data size | Member size |
+--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
@end verbatim
All multibyte values are stored in little endian order.
@table @samp
@item ID string (the "magic" bytes)
A four byte string, identifying the lzip format, with the value "LZIP"
(0x4C, 0x5A, 0x49, 0x50).
@item VN (version number, 1 byte)
Just in case something needs to be modified in the future. 1 for now.
@anchor{coded-dict-size}
@item DS (coded dictionary size, 1 byte)
The dictionary size is calculated by taking a power of 2 (the base size)
and subtracting from it a fraction between 0/16 and 7/16 of the base size.@*
Bits 4-0 contain the base 2 logarithm of the base size (12 to 29).@*
Bits 7-5 contain the numerator of the fraction (0 to 7) to subtract
from the base size to obtain the dictionary size.@*
Example: 0xD3 = 2^19 - 6 * 2^15 = 512 KiB - 6 * 32 KiB = 320 KiB@*
Valid values for dictionary size range from 4 KiB to 512 MiB.
@item LZMA stream
The LZMA stream, finished by an "End Of Stream" marker. Uses default values
for encoder properties.
@ifnothtml
@xref{Stream format,,,lzip},
@end ifnothtml
@ifhtml
See
@uref{http://www.nongnu.org/lzip/manual/lzip_manual.html#Stream-format,,Stream format}
@end ifhtml
for a complete description.
@item CRC32 (4 bytes)
Cyclic Redundancy Check (CRC) of the original uncompressed data.
@item Data size (8 bytes)
Size of the original uncompressed data.
@item Member size (8 bytes)
Total size of the member, including header and trailer. This field acts
as a distributed index, improves the checking of stream integrity, and
facilitates the safe recovery of undamaged members from multimember files.
Lzip limits the member size to @w{2 PiB} to prevent the data size field from
overflowing.
@end table
@node Trailing data
@chapter Extra data appended to the file
@cindex trailing data
@ -742,7 +794,7 @@ example when writing to a tape. It is safe to append any amount of
padding zero bytes to a lzip file.
@item
Useful data added by the user; an "End Of File" string (to check that the
Useful data added by the user; an 'End Of File' string (to check that the
file has not been truncated), a cryptographically secure hash, a description
of file contents, etc. It is safe to append any amount of text to a lzip
file as long as none of the first four bytes of the text matches the
@ -794,9 +846,8 @@ compression can only be detected by comparing the compressed file with the
original because the corruption happens before plzip compresses the RAM
contents, resulting in a valid compressed file containing wrong data.
@sp 1
@noindent
Example 1: Extract all the files from archive @samp{foo.tar.lz}.
Example 1: Extract all the files from archive @file{foo.tar.lz}.
@example
tar -xf foo.tar.lz
@ -804,43 +855,38 @@ or
plzip -cd foo.tar.lz | tar -xf -
@end example
@sp 1
@noindent
Example 2: Replace a regular file with its compressed version @samp{file.lz}
Example 2: Replace a regular file with its compressed version @file{file.lz}
and show the compression ratio.
@example
plzip -v file
@end example
@sp 1
@noindent
Example 3: Like example 2 but the created @samp{file.lz} has a block size of
Example 3: Like example 2 but the created @file{file.lz} has a block size of
@w{1 MiB}. The compression ratio is not shown.
@example
plzip -B 1MiB file
@end example
@sp 1
@noindent
Example 4: Restore a regular file from its compressed version
@samp{file.lz}. If the operation is successful, @samp{file.lz} is removed.
@file{file.lz}. If the operation is successful, @file{file.lz} is removed.
@example
plzip -d file.lz
@end example
@sp 1
@noindent
Example 5: Check the integrity of the compressed file @samp{file.lz} and
Example 5: Check the integrity of the compressed file @file{file.lz} and
show status.
@example
plzip -tv file.lz
@end example
@sp 1
@anchor{concat-example}
@noindent
Example 6: The right way of concatenating the decompressed output of two or
@ -853,28 +899,25 @@ Do this instead
plzip -cd file1.lz file2.lz file3.lz
@end example
@sp 1
@noindent
Example 7: Decompress @samp{file.lz} partially until @w{10 KiB} of
Example 7: Decompress @file{file.lz} partially until @w{10 KiB} of
decompressed data are produced.
@example
plzip -cd file.lz | dd bs=1024 count=10
@end example
@sp 1
@noindent
Example 8: Decompress @samp{file.lz} partially from decompressed byte at
Example 8: Decompress @file{file.lz} partially from decompressed byte at
offset 10000 to decompressed byte at offset 14999 (5000 bytes are produced).
@example
plzip -cd file.lz | dd bs=1000 skip=10 count=5
@end example
@sp 1
@noindent
Example 9: Compress a whole device in /dev/sdc and send the output to
@samp{file.lz}.
@file{file.lz}.
@example
plzip -c /dev/sdc > file.lz