diff options
Diffstat (limited to 'doc/tarlz.texi')
-rw-r--r-- | doc/tarlz.texi | 220 |
1 files changed, 124 insertions, 96 deletions
diff --git a/doc/tarlz.texi b/doc/tarlz.texi index f37164f..79c145d 100644 --- a/doc/tarlz.texi +++ b/doc/tarlz.texi @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 3 January 2024 -@set VERSION 0.25 +@set UPDATED 7 December 2024 +@set VERSION 0.26 @dircategory Archiving @direntry @@ -38,6 +38,7 @@ This manual is for Tarlz (version @value{VERSION}, @value{UPDATED}). @menu * Introduction:: Purpose and features of tarlz * Invoking tarlz:: Command-line interface +* Argument syntax:: By convention, options start with a hyphen * Portable character set:: POSIX portable filename character set * File format:: Detailed format of the compressed archive * Amendments to pax format:: The reasons for the differences with pax @@ -150,21 +151,22 @@ Tarlz does not use absolute file names nor file names above the current working directory (perhaps changed by option @option{-C}). On archive creation or appending tarlz archives the files specified, but removes from member names any leading and trailing slashes and any file name prefixes containing -a @samp{..} component. On extraction, leading and trailing slashes are also -removed from member names, and archive members containing a @samp{..} +a @file{..} component. On extraction, leading and trailing slashes are also +removed from member names, and archive members containing a @file{..} component in the file name are skipped. Tarlz does not follow symbolic links during extraction; not even symbolic links replacing intermediate directories. -On extraction and listing, tarlz removes leading @samp{./} strings from +On extraction and listing, tarlz removes leading @file{./} strings from member names in the archive or given in the command line, so that -@w{@samp{tarlz -xf foo ./bar baz}} extracts members @samp{bar} and -@samp{./baz} from archive @samp{foo}. +@w{@samp{tarlz -xf foo ./bar baz}} extracts members @file{bar} and +@file{./baz} from archive @file{foo}. If several compression levels or @option{--*solid} options are given, the last setting is used. For example @w{@option{-9 --solid --uncompressed -1}} is equivalent to @w{@option{-1 --solid}}. +@noindent tarlz supports the following operations: @table @code @@ -277,7 +279,7 @@ standard output (unless the option @option{--output} is used). Tarlz can be used as compressor for GNU tar by using a command like @w{@samp{tar -c -Hustar foo | tarlz -z -o foo.tar.lz}}. Tarlz can be used as compressor for zupdate (zutils) by using a command like -@w{@samp{zupdate --lz="tarlz -z" foo.tar.gz}}. Note that tarlz only works +@w{@samp{zupdate --lz='tarlz -z' foo.tar.gz}}. Note that tarlz only works reliably on archives without global headers, or with global headers whose content can be ignored. @@ -285,10 +287,10 @@ The compression is reversible, including any garbage present after the end-of-archive blocks. Tarlz stops parsing after the first end-of-archive block is found, and then compresses the rest of the archive. Unless solid compression is requested, the end-of-archive blocks are compressed in a lzip -member separated from the preceding members and from any non-zero garbage +member separated from the preceding members and from any nonzero garbage following the end-of-archive blocks. @option{--compress} implies plzip argument style, not tar style. Each input archive is compressed to a file -with the extension @samp{.lz} added unless the option @option{--output} is +with the extension @file{.lz} added unless the option @option{--output} is used. When @option{--output} is used, only one input archive can be specified. @option{-f} can't be used with @option{--compress}. @@ -308,11 +310,8 @@ and the value of LZ_API_VERSION (if defined). @end table -tarlz 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 +tarlz supports the following options: @xref{Argument syntax}. @table @code @anchor{--data-size} @@ -326,17 +325,17 @@ defaults to @w{1 MiB}. @xref{Minimum archive sizes}. @item -C @var{dir} @itemx --directory=@var{dir} Change to directory @var{dir}. When creating, appending, comparing, or -extracting, the position of each @option{-C} option in the command line is +extracting, the position of each option @option{-C} in the command line is significant; it changes the current working directory for the following -@var{files} until a new @option{-C} option appears in the command line. -@option{--list} and @option{--delete} ignore any @option{-C} options +@var{files} until a new option @option{-C} appears in the command line. +@option{--list} and @option{--delete} ignore any option @option{-C} specified. @var{dir} is relative to the then current working directory, -perhaps changed by a previous @option{-C} option. +perhaps changed by a previous option @option{-C}. Note that a process can only have one current working directory (CWD). -Therefore multi-threading can't be used to create or decode an archive if a -@option{-C} option appears after a (relative) file name in the command line. -(All file names are made relative when decoding). +Therefore multi-threading can't be used to create or decode an archive if an +option @option{-C} appears after a (relative) file name in the command line. +(All file names are made relative by removing leading slashes when decoding). @item -f @var{archive} @itemx --file=@var{archive} @@ -351,7 +350,7 @@ Archive or compare the files they point to instead of the links themselves. @item -n @var{n} @itemx --threads=@var{n} Set the number of (de)compression threads, overriding the system's default. -Valid values range from 0 to "as many as your system can support". A value +Valid values range from 0 to as many as your system can support. A value of 0 disables threads entirely. If this option is not used, tarlz tries to detect the number of processors in the system and use it as default value. @w{@samp{tarlz --help}} shows the system's default value. See the note about @@ -391,7 +390,7 @@ tarlz also minimizes the dictionary size of the lzip members it creates, reducing the amount of memory required for decompression. @multitable {Level} {Dictionary size} {Match length limit} -@item Level @tab Dictionary size @tab Match length limit +@headitem Level @tab Dictionary size @tab Match length limit @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 @@ -410,7 +409,7 @@ uncompressed tar archive instead. With @option{--append}, don't compress the new members appended to the tar archive. Compressed members can't be appended to an uncompressed archive, nor vice versa. @option{--uncompressed} can be omitted if it can be deduced from the archive name. (An uncompressed -archive name lacks a @samp{.lz} or @samp{.tlz} extension). +archive name lacks a @file{.lz} or @file{.tlz} extension). @item --asolid When creating or appending to a compressed archive, use appendable solid @@ -466,11 +465,11 @@ If @var{group} is not a valid group name, it is decoded as a decimal numeric group ID. @item --exclude=@var{pattern} -Exclude files matching a shell pattern like @samp{*.o}. A file is considered -to match if any component of the file name matches. For example, @samp{*.o} -matches @samp{foo.o}, @samp{foo.o/bar} and @samp{foo/bar.o}. If +Exclude files matching a shell pattern like @file{*.o}. A file is considered +to match if any component of the file name matches. For example, @file{*.o} +matches @file{foo.o}, @file{foo.o/bar} and @file{foo/bar.o}. If @var{pattern} contains a @samp{/}, it matches a corresponding @samp{/} in -the file name. For example, @samp{foo/*.o} matches @samp{foo/bar.o}. +the file name. For example, @file{foo/*.o} matches @file{foo/bar.o}. Multiple @option{--exclude} options can be specified. @item --ignore-ids @@ -545,6 +544,53 @@ etc), 2 to indicate a corrupt or invalid input file, 3 for an internal consistency error (e.g., bug) which caused tarlz 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). +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 + + @node Portable character set @chapter POSIX portable filename character set @cindex portable character set @@ -587,10 +633,11 @@ represents one byte; a box like this: represents a variable number of bytes or a fixed but large number of bytes (for example 512). -@sp 1 +@noindent A tar.lz file consists of one or more lzip members (compressed data sets). The members simply appear one after another in the file, with no additional -information before, between, or after them. +information before, between, or after them. Empty members (data size = 0) +are not allowed in multimember files. Each lzip member contains one or more tar members in a simplified POSIX pax interchange format. The only pax typeflag value supported by tarlz (in @@ -628,7 +675,7 @@ binary zeros, interpreted as an end-of-archive indicator. These EOA blocks are either compressed in a separate lzip member or compressed along with the tar members contained in the last lzip member. For a compressed archive to be recognized by tarlz as appendable, the last lzip member must contain -between 512 and 32256 zeros alone (without any non-zero bytes). +between 512 and 32256 zeros alone (without any nonzero bytes). The diagram below shows the correspondence between each tar member (formed by one or two headers plus optional data) in the tar archive and each @@ -652,25 +699,24 @@ tar.lz @end verbatim @ignore -When @option{--permissive} is used, the following violations of the -archive format are allowed:@* -If several extended headers precede an ustar header, only the last -extended header takes effect. The other extended headers are ignored. -Similarly, if several records with the same keyword appear in the same -block of extended records, only the last record for the repeated keyword -takes effect. The other records for the repeated keyword are ignored.@* -A global header inserted between an extended header and an ustar header.@* +When @option{--permissive} is used, the following violations of the archive +format are allowed:@* +If several extended headers precede a ustar header, only the last extended +header takes effect. The other extended headers are ignored. Similarly, if +several records with the same keyword appear in the same block of extended +records, only the last record for the repeated keyword takes effect. The +other records for the repeated keyword are ignored.@* +A global header inserted between an extended header and a ustar header.@* An extended header just before the end-of-archive blocks. @end ignore -@sp 1 @section Pax header block The pax header block is identical to the ustar header block described below except that the typeflag has the value @samp{x} (extended). The field @samp{size} is the size of the extended header data in bytes. Most other fields in the pax header block are zeroed on archive creation to prevent -trouble if the archive is read by an ustar tool, and are ignored by tarlz on +trouble if the archive is read by a ustar tool, and are ignored by tarlz on archive extraction. @xref{flawed-compat}. Tarlz limits the size of the pax extended header data so that the whole @@ -756,14 +802,13 @@ swapping of two bytes. At verbosity level 1 or higher tarlz prints a diagnostic for each unknown extended header keyword found in an archive, once per keyword. -@sp 1 @section Ustar header block The ustar header block has a length of 512 bytes and is structured as -shown in the following table. All lengths and offsets are in decimal. +shown in the following table. All lengths and offsets are in decimal: @multitable {Field Name} {Offset} {Length (in bytes)} -@item Field Name @tab Offset @tab Length (in bytes) +@headitem Field Name @tab Offset @tab Length (in bytes) @item name @tab 0 @tab 100 @item mode @tab 100 @tab 8 @item uid @tab 108 @tab 8 @@ -901,7 +946,6 @@ In order to achieve this goal and avoid some other flaws in the pax format, tarlz makes some changes to the variant of the pax format that it uses. This chapter describes these changes and the concrete reasons to implement them. -@sp 1 @anchor{crc32} @section Add a CRC of the extended records @@ -928,7 +972,6 @@ Because of the above, tarlz protects the extended records with a Cyclic Redundancy Check (CRC) in a way compatible with standard tar tools. @xref{key_crc32}. -@sp 1 @anchor{flawed-compat} @section Remove flawed backward compatibility @@ -958,12 +1001,11 @@ extraction. If an extended header is required for any reason (for example a file size of @w{8 GiB} or larger, or a link name longer than 100 bytes), tarlz also moves -the file name to the extended records to prevent an ustar tool from trying -to extract the file or link. This also makes easier during parallel decoding +the file name to the extended records to prevent a ustar tool from trying to +extract the file or link. This also makes easier during parallel decoding the detection of a tar member split between two lzip members at the boundary between the extended header and the ustar header. -@sp 1 @section As simple as possible (but not simpler) The tarlz format is mainly ustar. Extended pax headers are used only when @@ -978,7 +1020,6 @@ Global pax headers are tolerated, but not supported; they are parsed and ignored. Some operations may not behave as expected if the archive contains global headers. -@sp 1 @section Improve reproducibility Pax includes by default the process ID of the pax process in the ustar name @@ -990,7 +1031,6 @@ Pax allows an extended record to have length x-1 or x if x is a power of ten; @samp{99<97_bytes>} or @samp{100<97_bytes>}. Tarlz minimizes the length of the record and always produces a length of x-1 in these cases. -@sp 1 @section No data in hard links Tarlz does not allow data in hard link members. The data (if any) must be in @@ -999,7 +1039,6 @@ the names of a file are stored as hard links, the type of the file is lost. Not allowing data in hard links also prevents invalid actions like extracting file data for a hard link to a symbolic link or to a directory. -@sp 1 @section Avoid misconversions to/from UTF-8 There is no portable way to tell what charset a text string is coded into. @@ -1025,7 +1064,7 @@ added complication of the solidity levels. @xref{Program design,,,plzip}. @end ifnothtml A grouper thread and several worker threads are created, acting the main -thread as muxer (multiplexer) thread. A "packet courier" takes care of data +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. @@ -1074,8 +1113,8 @@ access files in the file system either to read them (diff) or write them As misaligned tar.lz archives can't be decoded in parallel, and the misalignment can't be detected until after decoding has started, a -"mastership request" mechanism has been designed that allows the decoding to -continue instead of signalling an error. +'mastership request' mechanism has been designed that allows the decoding to +continue instead of exiting with an error. During parallel decoding, if a worker finds a misalignment, it requests mastership to decode the rest of the archive. When mastership is requested, @@ -1098,12 +1137,12 @@ error be avoided. @chapter Limitations of parallel tar decoding @cindex parallel tar decoding -Safely decoding an arbitrary tar archive in parallel is only possible if one -decodes the headers sequentially first. For example, if a tar archive -containing another tar archive is decoded starting from some position other -than the beginning, there is no way to know if the first header found there -belongs to the outer tar archive or to the inner tar archive. Tar is a -format inherently serial; it was designed for tapes. +Safely decoding a tar archive in parallel is only possible if one decodes +the headers sequentially first. For example, if a tar archive containing +another tar archive is decoded starting from some position other than the +beginning, there is no way to know if the first header found there belongs +to the outer tar archive or to the inner tar archive. Tar is a format +inherently serial; it was designed for tapes. The pax format is even more serial than the ustar format. Two headers need to be decoded sequentially for each file. The extended header may even need @@ -1153,7 +1192,6 @@ the tar member data because it only decodes the part of each lzip member corresponding to the tar member header. This is another reason why the tar headers must provide their own integrity checking. -@sp 1 @anchor{mt-extraction} @section Limitations of multi-threaded extraction @@ -1225,40 +1263,37 @@ data size for each level: @cindex examples @noindent -Example 1: Create a multimember compressed archive @samp{archive.tar.lz} -containing files @samp{a}, @samp{b} and @samp{c}. +Example 1: Create a multimember compressed archive @file{archive.tar.lz} +containing files @file{a}, @file{b} and @file{c}. @example tarlz -cf archive.tar.lz a b c @end example -@sp 1 @noindent -Example 2: Append files @samp{d} and @samp{e} to the multimember compressed -archive @samp{archive.tar.lz}. +Example 2: Append files @file{d} and @file{e} to the multimember compressed +archive @file{archive.tar.lz}. @example tarlz -rf archive.tar.lz d e @end example -@sp 1 @noindent Example 3: Create a solidly compressed appendable archive -@samp{archive.tar.lz} containing files @samp{a}, @samp{b} and @samp{c}. -Then append files @samp{d} and @samp{e} to the archive. +@file{archive.tar.lz} containing files @file{a}, @file{b} and @file{c}. +Then append files @file{d} and @file{e} to the archive. @example tarlz --asolid -cf archive.tar.lz a b c tarlz --asolid -rf archive.tar.lz d e @end example -@sp 1 @noindent Example 4: Create a compressed appendable archive containing directories -@samp{dir1}, @samp{dir2} and @samp{dir3} with a separate lzip member per -directory. Then append files @samp{a}, @samp{b}, @samp{c}, @samp{d} and -@samp{e} to the archive, all of them contained in a single lzip member. -The resulting archive @samp{archive.tar.lz} contains 5 lzip members +@file{dir1}, @file{dir2} and @file{dir3} with a separate lzip member per +directory. Then append files @file{a}, @file{b}, @file{c}, @file{d} and +@file{e} to the archive, all of them contained in a single lzip member. +The resulting archive @file{archive.tar.lz} contains 5 lzip members (including the end-of-archive member). @example @@ -1266,46 +1301,41 @@ tarlz --dsolid -cf archive.tar.lz dir1 dir2 dir3 tarlz --asolid -rf archive.tar.lz a b c d e @end example -@sp 1 @noindent -Example 5: Create a solidly compressed archive @samp{archive.tar.lz} -containing files @samp{a}, @samp{b} and @samp{c}. Note that no more +Example 5: Create a solidly compressed archive @file{archive.tar.lz} +containing files @file{a}, @file{b} and @file{c}. Note that no more files can be later appended to the archive. @example tarlz --solid -cf archive.tar.lz a b c @end example -@sp 1 @noindent -Example 6: Extract all files from archive @samp{archive.tar.lz}. +Example 6: Extract all files from archive @file{archive.tar.lz}. @example tarlz -xf archive.tar.lz @end example -@sp 1 @noindent -Example 7: Extract files @samp{a} and @samp{c}, and the whole tree under -directory @samp{dir1} from archive @samp{archive.tar.lz}. +Example 7: Extract files @file{a} and @file{c}, and the whole tree under +directory @file{dir1} from archive @file{archive.tar.lz}. @example tarlz -xf archive.tar.lz a c dir1 @end example -@sp 1 @noindent -Example 8: Copy the contents of directory @samp{sourcedir} to the directory -@samp{destdir}. +Example 8: Copy the contents of directory @file{sourcedir} to the directory +@file{destdir}. @example tarlz -C sourcedir --uncompressed -cf - . | tarlz -C destdir -xf - @end example -@sp 1 @noindent -Example 9: Compress the existing POSIX archive @samp{archive.tar} and write -the output to @samp{archive.tar.lz}. Compress each member individually for +Example 9: Compress the existing POSIX archive @file{archive.tar} and write +the output to @file{archive.tar.lz}. Compress each member individually for maximum availability. (If one member in the compressed archive gets damaged, the other members can still be extracted). @@ -1313,19 +1343,17 @@ the other members can still be extracted). tarlz -z --no-solid archive.tar @end example -@sp 1 @noindent -Example 10: Compress the archive @samp{archive.tar} and write the output to -@samp{foo.tar.lz}. +Example 10: Compress the archive @file{archive.tar} and write the output to +@file{foo.tar.lz}. @example tarlz -z -o foo.tar.lz archive.tar @end example -@sp 1 @noindent -Example 11: Concatenate and compress two archives @samp{archive1.tar} and -@samp{archive2.tar}, and write the output to @samp{foo.tar.lz}. +Example 11: Concatenate and compress two archives @file{archive1.tar} and +@file{archive2.tar}, and write the output to @file{foo.tar.lz}. @example tarlz -A archive1.tar archive2.tar | tarlz -z -o foo.tar.lz |