diff options
Diffstat (limited to '')
-rw-r--r-- | doc/tarlz.1 | 5 | ||||
-rw-r--r-- | doc/tarlz.info | 213 | ||||
-rw-r--r-- | doc/tarlz.texi | 220 |
3 files changed, 248 insertions, 190 deletions
diff --git a/doc/tarlz.1 b/doc/tarlz.1 index 9d63da5..c1e6dd6 100644 --- a/doc/tarlz.1 +++ b/doc/tarlz.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.49.2. -.TH TARLZ "1" "January 2024" "tarlz 0.25" "User Commands" +.TH TARLZ "1" "December 2024" "tarlz 0.26" "User Commands" .SH NAME tarlz \- creates tar archives with multimember lzip compression .SH SYNOPSIS @@ -161,11 +161,12 @@ Report bugs to lzip\-bug@nongnu.org Tarlz home page: http://www.nongnu.org/lzip/tarlz.html .SH COPYRIGHT Copyright \(co 2024 Antonio Diaz Diaz. -Using lzlib 1.14\-rc1 License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html> .br This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. +Using lzlib 1.15\-rc1 +Using LZ_API_VERSION = 1015 .SH "SEE ALSO" The full documentation for .B tarlz diff --git a/doc/tarlz.info b/doc/tarlz.info index 25ba882..46d5ab4 100644 --- a/doc/tarlz.info +++ b/doc/tarlz.info @@ -11,12 +11,13 @@ File: tarlz.info, Node: Top, Next: Introduction, Up: (dir) Tarlz Manual ************ -This manual is for Tarlz (version 0.25, 3 January 2024). +This manual is for Tarlz (version 0.26, 7 December 2024). * 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 @@ -92,7 +93,7 @@ in a way compatible with standard tar tools. *Note crc32::. be used to check that the format of the archive is compatible with tarlz. -File: tarlz.info, Node: Invoking tarlz, Next: Portable character set, Prev: Introduction, Up: Top +File: tarlz.info, Node: Invoking tarlz, Next: Argument syntax, Prev: Introduction, Up: Top 2 Invoking tarlz **************** @@ -127,7 +128,7 @@ member names in the archive or given in the command line, so that setting is used. For example '-9 --solid --uncompressed -1' is equivalent to '-1 --solid'. - tarlz supports the following operations: +tarlz supports the following operations: '--help' Print an informative help message describing the options and exit. @@ -240,7 +241,7 @@ to '-1 --solid'. used as compressor for GNU tar by using a command like 'tar -c -Hustar foo | tarlz -z -o foo.tar.lz'. Tarlz can be used as compressor for zupdate (zutils) by using a command like - 'zupdate --lz="tarlz -z" foo.tar.gz'. Note that tarlz only works + '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. @@ -249,7 +250,7 @@ to '-1 --solid'. 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 following the end-of-archive + members and from any nonzero garbage following the end-of-archive blocks. '--compress' implies plzip argument style, not tar style. Each input archive is compressed to a file with the extension '.lz' added unless the option '--output' is used. When '--output' is used, only @@ -268,8 +269,7 @@ to '-1 --solid'. (lzlib)Library version. - tarlz supports the following options: *Note Argument syntax: -(arg_parser)Argument syntax. +tarlz supports the following options: *Note Argument syntax::. '-B BYTES' '--data-size=BYTES' @@ -281,17 +281,18 @@ to '-1 --solid'. '-C DIR' '--directory=DIR' Change to directory DIR. When creating, appending, comparing, or - extracting, the position of each '-C' option in the command line is + extracting, the position of each option '-C' in the command line is significant; it changes the current working directory for the following - FILES until a new '-C' option appears in the command line. '--list' - and '--delete' ignore any '-C' options specified. DIR is relative to - the then current working directory, perhaps changed by a previous '-C' - option. + FILES until a new option '-C' appears in the command line. '--list' + and '--delete' ignore any option '-C' specified. DIR is relative to + the then current working directory, perhaps changed by a previous + 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 '-C' option appears after a (relative) file name in the command - line. (All file names are made relative when decoding). + if an option '-C' appears after a (relative) file name in the command + line. (All file names are made relative by removing leading slashes + when decoding). '-f ARCHIVE' '--file=ARCHIVE' @@ -307,10 +308,10 @@ to '-1 --solid'. '-n N' '--threads=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 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. 'tarlz --help' shows the system's default + default. 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. 'tarlz --help' shows the system's default value. See the note about multi-threading in the option '-C' above. Note that the number of usable threads is limited during compression to @@ -347,6 +348,7 @@ to '-1 --solid'. reducing the amount of memory required for decompression. Level Dictionary size Match length limit + -------------------------------------------- -0 64 KiB 16 bytes -1 1 MiB 5 bytes -2 1.5 MiB 6 bytes @@ -496,9 +498,52 @@ indicate a corrupt or invalid input file, 3 for an internal consistency error (e.g., bug) which caused tarlz to panic. -File: tarlz.info, Node: Portable character set, Next: File format, Prev: Invoking tarlz, Up: Top +File: tarlz.info, Node: Argument syntax, Next: Portable character set, Prev: Invoking tarlz, Up: Top -3 POSIX portable filename character set +3 Syntax of command-line arguments +********************************** + +POSIX recommends these conventions for command-line arguments. + + * A command-line argument is an option if it begins with a hyphen ('-'). + + * Option names are single alphanumeric characters. + + * Certain options require an argument. + + * An option and its argument may or may not appear as separate tokens. + (In other words, the whitespace separating them is optional). Thus, + '-o foo' and '-ofoo' are equivalent. + + * 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, + '-abc' is equivalent to '-a -b -c'. + + * Options typically precede other non-option arguments. + + * The argument '--' terminates all options; any following arguments are + treated as non-option arguments, even if they begin with a hyphen. + + * 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 '-'. + +GNU adds "long options" to these conventions: + + * A long option consists of two hyphens ('--') 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. + + * 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 '='. + Thus, '--foo bar' and '--foo=bar' are equivalent. + + +File: tarlz.info, Node: Portable character set, Next: File format, Prev: Argument syntax, Up: Top + +4 POSIX portable filename character set *************************************** The set of characters from which portable file names are constructed. @@ -516,7 +561,7 @@ names use only the portable character set without spaces added. File: tarlz.info, Node: File format, Next: Amendments to pax format, Prev: Portable character set, Up: Top -4 File format +5 File format ************* In the diagram below, a box like this: @@ -534,10 +579,10 @@ In the diagram below, a box like this: represents a variable number of bytes or a fixed but large number of bytes (for example 512). - - 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. +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. 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 @@ -570,7 +615,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 @@ -587,15 +632,14 @@ tar.lz | member | member | member | +===============+=================================================+========+ - -4.1 Pax header block +5.1 Pax header block ==================== The pax header block is identical to the ustar header block described below except that the typeflag has the value 'x' (extended). The field '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 archive +archive is read by a ustar tool, and are ignored by tarlz on archive extraction. *Note flawed-compat::. Tarlz limits the size of the pax extended header data so that the whole @@ -682,14 +726,14 @@ space, equal-sign, and newline. At verbosity level 1 or higher tarlz prints a diagnostic for each unknown extended header keyword found in an archive, once per keyword. - -4.2 Ustar header block +5.2 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. +in the following table. All lengths and offsets are in decimal: Field Name Offset Length (in bytes) +--------------------------------------- name 0 100 mode 100 8 uid 108 8 @@ -810,7 +854,7 @@ longer than standard ustar by not requiring a terminating null character. File: tarlz.info, Node: Amendments to pax format, Next: Program design, Prev: File format, Up: Top -5 The reasons for the differences with pax +6 The reasons for the differences with pax ****************************************** Tarlz creates safe archives that allow the reliable detection of invalid or @@ -821,8 +865,7 @@ 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. - -5.1 Add a CRC of the extended records +6.1 Add a CRC of the extended records ===================================== The POSIX pax format has a serious flaw. The metadata stored in pax extended @@ -849,8 +892,7 @@ place. Redundancy Check (CRC) in a way compatible with standard tar tools. *Note key_crc32::. - -5.2 Remove flawed backward compatibility +6.2 Remove flawed backward compatibility ======================================== In order to allow the extraction of pax archives by a tar utility conforming @@ -878,13 +920,12 @@ violations during parallel extraction. If an extended header is required for any reason (for example a file size of 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 +moves 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. - -5.3 As simple as possible (but not simpler) +6.3 As simple as possible (but not simpler) =========================================== The tarlz format is mainly ustar. Extended pax headers are used only when @@ -899,8 +940,7 @@ corruption. ignored. Some operations may not behave as expected if the archive contains global headers. - -5.4 Improve reproducibility +6.4 Improve reproducibility =========================== Pax includes by default the process ID of the pax process in the ustar name @@ -912,8 +952,7 @@ extended records, making it easier to produce reproducible archives. ten; '99<97_bytes>' or '100<97_bytes>'. Tarlz minimizes the length of the record and always produces a length of x-1 in these cases. - -5.5 No data in hard links +6.5 No data in hard links ========================= Tarlz does not allow data in hard link members. The data (if any) must be in @@ -922,8 +961,7 @@ 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. - -5.6 Avoid misconversions to/from UTF-8 +6.6 Avoid misconversions to/from UTF-8 ====================================== There is no portable way to tell what charset a text string is coded into. @@ -935,7 +973,7 @@ be adjusted with a command-line option in the future. File: tarlz.info, Node: Program design, Next: Multi-threaded decoding, Prev: Amendments to pax format, Up: Top -6 Internal structure of tarlz +7 Internal structure of tarlz ***************************** The parts of tarlz related to sequential processing of the archive are more @@ -947,7 +985,7 @@ processing. creation is somewhat similar to that of plzip with the added complication of the solidity levels. *Note Program design: (plzip)Program design. 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. @@ -993,8 +1031,8 @@ the archive. 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, @@ -1015,15 +1053,15 @@ error be avoided. File: tarlz.info, Node: Multi-threaded decoding, Next: Minimum archive sizes, Prev: Program design, Up: Top -7 Limitations of parallel tar decoding +8 Limitations of 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 @@ -1071,8 +1109,7 @@ 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. - -7.1 Limitations of multi-threaded extraction +8.1 Limitations of multi-threaded extraction ============================================ Multi-threaded extraction may produce different output than single-threaded @@ -1102,7 +1139,7 @@ links to. File: tarlz.info, Node: Minimum archive sizes, Next: Examples, Prev: Multi-threaded decoding, Up: Top -8 Minimum archive sizes required for multi-threaded block compression +9 Minimum archive sizes required for multi-threaded block compression ********************************************************************* When creating or appending to a compressed archive using multi-threaded @@ -1140,21 +1177,19 @@ Level File: tarlz.info, Node: Examples, Next: Problems, Prev: Minimum archive sizes, Up: Top -9 A small tutorial with examples -******************************** +10 A small tutorial with examples +********************************* Example 1: Create a multimember compressed archive 'archive.tar.lz' containing files 'a', 'b' and 'c'. tarlz -cf archive.tar.lz a b c - Example 2: Append files 'd' and 'e' to the multimember compressed archive 'archive.tar.lz'. tarlz -rf archive.tar.lz d e - Example 3: Create a solidly compressed appendable archive 'archive.tar.lz' containing files 'a', 'b' and 'c'. Then append files 'd' and 'e' to the archive. @@ -1162,7 +1197,6 @@ archive. tarlz --asolid -cf archive.tar.lz a b c tarlz --asolid -rf archive.tar.lz d e - Example 4: Create a compressed appendable archive containing directories 'dir1', 'dir2' and 'dir3' with a separate lzip member per directory. Then append files 'a', 'b', 'c', 'd' and 'e' to the archive, all of them @@ -1172,31 +1206,26 @@ contains 5 lzip members (including the end-of-archive member). tarlz --dsolid -cf archive.tar.lz dir1 dir2 dir3 tarlz --asolid -rf archive.tar.lz a b c d e - Example 5: Create a solidly compressed archive 'archive.tar.lz' containing files 'a', 'b' and 'c'. Note that no more files can be later appended to the archive. tarlz --solid -cf archive.tar.lz a b c - Example 6: Extract all files from archive 'archive.tar.lz'. tarlz -xf archive.tar.lz - Example 7: Extract files 'a' and 'c', and the whole tree under directory 'dir1' from archive 'archive.tar.lz'. tarlz -xf archive.tar.lz a c dir1 - Example 8: Copy the contents of directory 'sourcedir' to the directory 'destdir'. tarlz -C sourcedir --uncompressed -cf - . | tarlz -C destdir -xf - - Example 9: Compress the existing POSIX archive 'archive.tar' and write the output to 'archive.tar.lz'. Compress each member individually for maximum availability. (If one member in the compressed archive gets damaged, the @@ -1204,13 +1233,11 @@ other members can still be extracted). tarlz -z --no-solid archive.tar - Example 10: Compress the archive 'archive.tar' and write the output to 'foo.tar.lz'. tarlz -z -o foo.tar.lz archive.tar - Example 11: Concatenate and compress two archives 'archive1.tar' and 'archive2.tar', and write the output to 'foo.tar.lz'. @@ -1219,7 +1246,7 @@ Example 11: Concatenate and compress two archives 'archive1.tar' and File: tarlz.info, Node: Problems, Next: Concept index, Prev: Examples, Up: Top -10 Reporting bugs +11 Reporting bugs ***************** There are probably bugs in tarlz. There are certainly errors and omissions @@ -1241,6 +1268,7 @@ Concept index * Menu: * Amendments to pax format: Amendments to pax format. (line 6) +* argument syntax: Argument syntax. (line 6) * bugs: Problems. (line 6) * examples: Examples. (line 6) * file format: File format. (line 6) @@ -1259,25 +1287,26 @@ Concept index Tag Table: Node: Top216 -Node: Introduction1207 -Node: Invoking tarlz4032 -Ref: --data-size13076 -Ref: --bsolid17512 -Node: Portable character set23425 -Node: File format24068 -Ref: key_crc3231050 -Ref: ustar-uid-gid34315 -Ref: ustar-mtime35122 -Node: Amendments to pax format37125 -Ref: crc3237834 -Ref: flawed-compat39146 -Node: Program design43228 -Node: Multi-threaded decoding47153 -Ref: mt-extraction50434 -Node: Minimum archive sizes51740 -Node: Examples53867 -Node: Problems56234 -Node: Concept index56789 +Node: Introduction1281 +Node: Invoking tarlz4106 +Ref: --data-size13109 +Ref: --bsolid17626 +Node: Argument syntax23539 +Node: Portable character set25314 +Node: File format25958 +Ref: key_crc3233001 +Ref: ustar-uid-gid36305 +Ref: ustar-mtime37112 +Node: Amendments to pax format39115 +Ref: crc3239823 +Ref: flawed-compat41134 +Node: Program design45211 +Node: Multi-threaded decoding49138 +Ref: mt-extraction52407 +Node: Minimum archive sizes53713 +Node: Examples55840 +Node: Problems58199 +Node: Concept index58754 End Tag Table 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 |