diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2016-05-20 06:54:36 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2016-05-20 06:54:36 +0000 |
commit | e6759ba4e68c66f0927bb89bfb87215eb29016ae (patch) | |
tree | f35bf07aaaf1ad2d1bfc0eced16ff820f1193cd5 /doc | |
parent | Adding upstream version 1.18~pre2. (diff) | |
download | lziprecover-e6759ba4e68c66f0927bb89bfb87215eb29016ae.tar.xz lziprecover-e6759ba4e68c66f0927bb89bfb87215eb29016ae.zip |
Adding upstream version 1.18.upstream/1.18
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/lziprecover.1 | 17 | ||||
-rw-r--r-- | doc/lziprecover.info | 223 | ||||
-rw-r--r-- | doc/lziprecover.texi | 212 |
3 files changed, 309 insertions, 143 deletions
diff --git a/doc/lziprecover.1 b/doc/lziprecover.1 index 87c0598..97f564f 100644 --- a/doc/lziprecover.1 +++ b/doc/lziprecover.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. -.TH LZIPRECOVER "1" "September 2015" "lziprecover 1.18-pre2" "User Commands" +.TH LZIPRECOVER "1" "May 2016" "lziprecover 1.18" "User Commands" .SH NAME lziprecover \- recovers data from damaged lzip files .SH SYNOPSIS @@ -12,9 +12,13 @@ Lziprecover can repair perfectly most files with small errors (up to one single\-byte error per member), without the need of any extra redundance at all. Losing an entire archive just because of a corrupt byte near the beginning is a thing of the past. +.PP Lziprecover can also produce a correct file by merging the good parts of two or more damaged copies, extract data from damaged files, decompress files and test integrity of files. +.PP +Lziprecover is not a replacement for regular backups, but a last line of +defense for the case where the backups are also damaged. .SH OPTIONS .TP \fB\-h\fR, \fB\-\-help\fR @@ -26,8 +30,11 @@ output version information and exit \fB\-a\fR, \fB\-\-trailing\-error\fR exit with error status if trailing data .TP +\fB\-A\fR, \fB\-\-alone\-to\-lz\fR +convert lzma\-alone files to lzip format +.TP \fB\-c\fR, \fB\-\-stdout\fR -send decompressed output to standard output +write to standard output, keep input files .TP \fB\-d\fR, \fB\-\-decompress\fR decompress @@ -60,7 +67,7 @@ suppress all messages try to repair a small error in file .TP \fB\-s\fR, \fB\-\-split\fR -split multi\-member file in single\-member files +split multimember file in single\-member files .TP \fB\-t\fR, \fB\-\-test\fR test compressed file integrity @@ -68,6 +75,8 @@ test compressed file integrity \fB\-v\fR, \fB\-\-verbose\fR be verbose (a 2nd \fB\-v\fR gives more) .PP +If no file names are given, or if a file is '\-', lziprecover decompresses +from standard input to standard output. Numbers may be followed by a multiplier: k = kB = 10^3 = 1000, Ki = KiB = 2^10 = 1024, M = 10^6, Mi = 2^20, G = 10^9, Gi = 2^30, etc... .PP @@ -80,7 +89,7 @@ Report bugs to lzip\-bug@nongnu.org .br Lziprecover home page: http://www.nongnu.org/lzip/lziprecover.html .SH COPYRIGHT -Copyright \(co 2015 Antonio Diaz Diaz. +Copyright \(co 2016 Antonio Diaz Diaz. 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. diff --git a/doc/lziprecover.info b/doc/lziprecover.info index 8d7bc66..17985d2 100644 --- a/doc/lziprecover.info +++ b/doc/lziprecover.info @@ -12,7 +12,7 @@ File: lziprecover.info, Node: Top, Next: Introduction, Up: (dir) Lziprecover Manual ****************** -This manual is for Lziprecover (version 1.18-pre2, 16 September 2015). +This manual is for Lziprecover (version 1.18, 12 May 2016). * Menu: @@ -30,7 +30,7 @@ This manual is for Lziprecover (version 1.18-pre2, 16 September 2015). * Concept index:: Index of concepts - Copyright (C) 2009-2015 Antonio Diaz Diaz. + Copyright (C) 2009-2016 Antonio Diaz Diaz. This manual is free documentation: you have unlimited permission to copy, distribute and modify it. @@ -47,6 +47,9 @@ files, produce a correct file by merging the good parts of two or more damaged copies, extract data from damaged files, decompress files and test integrity of files. + Lziprecover is not a replacement for regular backups, but a last +line of defense for the case where the backups are also damaged. + The lzip file format is designed for data sharing and long-term archiving, taking into account both data integrity and decoder availability: @@ -72,6 +75,10 @@ repair the nearer it is from the beginning of the file. Therefore, with the help of lziprecover, losing an entire archive just because of a corrupt byte near the beginning is a thing of the past. + For compressible data, multiple lzip-compressed copies have a better +chance of surviving intact than one uncompressed copy using the same +amount of storage space. + Lziprecover is able to recover or decompress files produced by any of the compressors in the lzip family; lzip, plzip, minilzip/lzlib, clzip and pdlzip. @@ -87,12 +94,11 @@ garbage data may be produced at the end of each member): lziprecover -D0 -i -o file -q file.lz - Lziprecover is able to efficiently extract a range of bytes from a -multi-member file, because it only decompresses the members containing -the desired data. + Lziprecover provides random access to the data in multimember files; +it only decompresses the members containing the desired data. Lziprecover can print correct total file sizes and ratios even for -multi-member files. +multimember files. When recovering data, lziprecover takes as arguments the names of the damaged files and writes zero or more recovered files depending on the @@ -102,9 +108,6 @@ damaged files themselves are never modified. When decompressing or testing file integrity, lziprecover behaves like lzip or lunzip. - Lziprecover is not a replacement for regular backups, but a last -line of defense for the case where the backups are also damaged. - File: lziprecover.info, Node: Invoking lziprecover, Next: Data safety, Prev: Introduction, Up: Top @@ -115,6 +118,10 @@ The format for running lziprecover is: lziprecover [OPTIONS] [FILES] +When decompressing or testing, '-' used as a FILE argument means +standard input. It can be mixed with other FILES and is read just once, +the first time it appears in the command line. + Lziprecover supports the following options: '-h' @@ -133,30 +140,51 @@ The format for running lziprecover is: trailing garbage that can be safely ignored. *Note concat-example::. +'-A' +'--alone-to-lz' + Convert lzma-alone files to lzip format without recompressing, just + adding a lzip header and trailer. The conversion minimizes the + dictionary size of the resulting file (and therefore the amount of + memory required to decompress it). Only streamed files with + default LZMA properties can be converted; non-streamed lzma-alone + files lack the end of stream marker required in lzip files. + + The name of the converted lzip file is derived from that of the + original lzma-alone file as follows: + + filename.lzma becomes filename.lz + filename.tlz becomes filename.tar.lz + anyothername becomes anyothername.lz + '-c' '--stdout' - Decompress to standard output. Needed when reading from a named - pipe (fifo) or from a device. Use it to recover as much of the + Write decompressed data to standard output; keep input files + unchanged. This option is needed when reading from a named pipe + (fifo) or from a device. Use it also to recover as much of the uncompressed data as possible when decompressing a corrupt file. '-d' '--decompress' - Decompress the specified file(s). If a file fails to decompress, - lziprecover exits immediately without decompressing the rest of the - files. + Decompress the specified file(s). If a file does not exist or + can't be opened, lziprecover continues decompressing the rest of + the files. If a file fails to decompress, lziprecover exits + immediately without decompressing the rest of the files. '-D RANGE' '--range-decompress=RANGE' Decompress only a range of bytes starting at decompressed byte - position 'BEGIN' and up to byte position 'END - 1'. Three formats - of RANGE are recognized, 'BEGIN', 'BEGIN-END', and 'BEGIN,SIZE'. - If only BEGIN is specified, END is taken as the end of the file. - The produced bytes are sent to standard output unless the - '--output' option is used. In order to guarantee the correctness - of the data produced, all members containing any part of the - desired data are decompressed and their integrity is verified. - This operation is more efficient in multi-member files because it - only decompresses the members containing the desired data. + position 'BEGIN' and up to byte position 'END - 1'. This option + provides random access to the data in multimember files; it only + decompresses the members containing the desired data. In order to + guarantee the correctness of the data produced, all members + containing any part of the desired data are decompressed and their + integrity is verified. + + Four formats of RANGE are recognized, 'BEGIN', 'BEGIN-END', + 'BEGIN,SIZE', and ',SIZE'. If only BEGIN is specified, END is taken + as the end of the file. If only SIZE is specified, BEGIN is taken + as the beginning of the file. The produced bytes are sent to + standard output unless the '--output' option is used. '-f' '--force' @@ -166,7 +194,7 @@ The format for running lziprecover is: '--ignore-errors' Make '--range-decompress' ignore data errors and continue decompressing the remaining members in the file. For example, - 'lziprecover -i -D0 file.lz > file' decompresses all the + 'lziprecover -D0 -i file.lz > file' decompresses all the recoverable data in all members of 'file.lz' without having to split it first. @@ -177,7 +205,7 @@ The format for running lziprecover is: '-l' '--list' Print total file sizes and ratios. The values produced are correct - even for multi-member files. Use it together with '-v' to see + even for multimember files. Use it together with '-v' to see information about the members in the file. '-m' @@ -195,7 +223,10 @@ The format for running lziprecover is: splitting, the names of the files produced are in the form 'rec01FILE', 'rec02FILE', etc. If decompressing from standard input and '--stdout' has not been specified, use 'FILE' as the - name of the decompressed file. + name of the decompressed file. If converting a lzma-alone file + from standard input and '--stdout' has not been specified, use + 'FILE.lz' as the name of the converted file. (Or plain 'FILE' if + it already ends in '.lz' or '.tlz'). '-q' '--quiet' @@ -270,15 +301,15 @@ File: lziprecover.info, Node: Data safety, Next: Repairing files, Prev: Invok ************************************** There are 3 main types of data corruption that may cause data loss: -single-byte errors, multi-byte errors (generally affecting a whole -sector in a block device), and total device failure. +single-byte errors, multibyte errors (generally affecting a whole sector +in a block device), and total device failure. Lziprecover protects natively against single-byte errors (*note Repairing files::), as long as file integrity is checked frequently enough that a second single-byte error does not develop in the same member before the first one is repaired. - Lziprecover also protects against multi-byte errors (*note Merging + Lziprecover also protects against multibyte errors (*note Merging files::), if at least one backup copy of the file is made. The only remedy for total device failure is storing backup copies in @@ -298,10 +329,10 @@ than one compressed data block (usually larger than 900 kB uncompressed), and if no block is damaged in both files, then the data can be manually recovered by splitting the files with bzip2recover, verifying every block and then copying the right blocks in the right -order in another file. +order into another file. But if you used lzip, the data can be automatically recovered as -long as no byte is damaged in both files. +long as the damaged areas don't overlap. Note that each error in a bzip2 file makes a whole block unusable, but each error in a lzip file only affects the damaged bytes, making it @@ -319,8 +350,8 @@ at all. If the reparation is successful, the repaired file will be identical bit for bit to the original. This makes lzip files resistant to bit-flip, one of the most common forms of data corruption. - The error may be located anywhere in the file except in the header -(first 6 bytes of each member) or in the 'Member size' field of the + The error may be located anywhere in the file except in the first 5 +bytes of each member header or in the 'Member size' field of the trailer (last 8 bytes of each member). If the error is in the header it can be easily repaired with a text editor like GNU Moe (*note File format::). If the error is in the member size, it is enough to ignore @@ -364,19 +395,13 @@ the file. is damaged in all copies), or are adjacent and the boundary can't be determined, or if the copies have too many damaged areas. - All the copies must have the same size. If some of them have been -truncated and are therefore smaller than they should, they can be -extended to the correct size with the following command before merging -them with the other copies: - - ddrescue --extend-outfile=<correct_size> small_file.lz extended_file.lz + All the copies must have the same size. If any of them is larger or +smaller than it should, either because it has been truncated or because +it got some garbage data appended at the end, it can be brought to the +correct size with the following command before merging it with the other +copies: - If some of the copies have got garbage data at the end and are -therefore larger than they should, their sizes can be reduced to the -correct value with the following command before merging them with the -other copies: - - ddrescue --size=<correct_size> large_file.lz reduced_file.lz + ddrescue -s<correct_size> -x<correct_size> file.lz correct_size_file.lz To give you an idea of its possibilities, when merging two copies, each of them with one damaged area affecting 1 percent of the copy, the @@ -427,7 +452,7 @@ additional information before, between, or after them. Each member has the following structure: +--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| ID string | VN | DS | Lzma stream | CRC32 | Data size | Member size | +| ID string | VN | DS | LZMA stream | CRC32 | Data size | Member size | +--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ All multibyte values are stored in little endian order. @@ -450,8 +475,8 @@ additional information before, between, or after them. 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. -'Lzma stream' - The lzma stream, finished by an end of stream marker. Uses default +'LZMA stream' + The LZMA stream, finished by an end of stream marker. Uses default values for encoder properties. *Note Stream format: (lzip)Stream format, for a complete description. @@ -465,7 +490,7 @@ additional information before, between, or after them. Total size of the member, including header and trailer. This field acts as a distributed index, allows the verification of stream integrity, and facilitates safe recovery of undamaged members from - multi-member files. + multimember files. @@ -490,15 +515,15 @@ member. Such trailing data may be: file. * In very rare cases, trailing data could be the corrupt header of - another member. In multi-member or concatenated files the + another member. In multimember or concatenated files the probability of corruption happening in the magic bytes is 5 times smaller than the probability of getting a false positive caused by the corruption of the integrity information itself. Therefore it can be considered to be below the noise level. Trailing data can be safely ignored in most cases. In some cases, -like user-added data, it is expected to be ignored. In those cases -where a file containing trailing data must be rejected, the option +like that of user-added data, it is expected to be ignored. In those +cases where a file containing trailing data must be rejected, the option '--trailing-error' can be used. *Note --trailing-error::. @@ -550,7 +575,7 @@ are abridged diagnostic messages from lziprecover). mv file_fixed.lz file.lz -Example 7: Split the multi-member file 'file.lz' and write each member +Example 7: Split the multimember file 'file.lz' and write each member in its own 'recXXXfile.lz' file. Then use 'lziprecover -t' to test the integrity of the resulting files. @@ -599,10 +624,22 @@ test robustness to decompression of corrupted data, inspired by unzcrash.c from Julian Seward's bzip2. Type 'make unzcrash' in the lziprecover source directory to build it. - Unzcrash reads the specified file and then repeatedly decompresses -it, increasing 256 times each byte of the compressed data, so as to -test all possible one-byte errors. This should not cause any invalid -memory accesses. If it does, please, report it as a bug. + By default, unzcrash reads the specified file and then repeatedly +decompresses it, increasing 256 times each byte of the compressed data, +so as to test all possible one-byte errors. + + If the '--block' option is given, unzcrash reads the specified file +and then repeatedly decompresses it, setting all bytes in each +successive block to the value given, so as to test all possible full +sector errors. + + If the '--truncate' option is given, unzcrash reads the specified +file and then repeatedly decompresses it, truncating the file to +increasing lengths, so as to test all possible truncation points. + + None of the three test modes described above should cause any invalid +memory accesses. If any of them does, please, report it as a bug to the +maintainers of the decompressor being tested. Unzcrash really executes as a subprocess the shell command specified in the first non-option argument, and then writes the file specified in @@ -611,6 +648,19 @@ modifying the corresponding byte each time. Therefore unzcrash can be used to test any decompressor (not only lzip), or even other decoder programs having a suitable command line syntax. + If the decompressor returns with zero status, unzcrash compares the +output of the decompressor for the original and corrupt files. If the +outputs differ, it means that the decompressor returned a false +negative; it failed to recognize the corruption and produced garbage +output. The only exception is when a multimember file is truncated just +after the last byte of a member, producing a shorter but valid +compressed file. Except in this latter case, please, report any false +negative as a bug. + + In order to compare the outputs, unzcrash needs a 'zcmp' program +able to understand the format being tested. For example the one provided +by 'zutils'. *Note Zcmp: (zutils)Zcmp, + The format for running unzcrash is: unzcrash [OPTIONS] "lzip -tv" FILENAME.lz @@ -642,9 +692,21 @@ programs having a suitable command line syntax. 1,3-5,8 1, 3, 4, 5 and 8 1-3,5-8 1, 2, 3, 5, 6, 7 and 8 +'-B[SIZE][,VALUE]' +'--block[=SIZE][,VALUE]' + Test block errors of given SIZE aligned to a SIZE-byte boundary, + simulating a whole sector I/O error. Block SIZE defaults to 512 + bytes. VALUE defaults to 0. + +'-d N' +'--delta=N' + Test only one of every N bytes, blocks or truncation sizes, + instead of all of them. + '-p BYTES' '--position=BYTES' - First byte position to test in the file. Defaults to 0. + First byte position to test in the file. Defaults to 0. Negative + values are relative to the end of the file. '-q' '--quiet' @@ -652,13 +714,24 @@ programs having a suitable command line syntax. '-s BYTES' '--size=BYTES' - Number of byte positions to test. If not specified, the whole file - is tested. + Number of byte positions to test. If not specified, the rest of + the file is tested (from '--position' to end of file). Negative + values are relative to the rest of the file. + +'-t' +'--truncate' + Test all possible truncation points in the range specified by + '--position' and '--size'. '-v' '--verbose' Verbose mode. +'-z' +'--zcmp=<command>' + Set zcmp command name and options. Defaults to 'zcmp'. Use + '--zcmp=false' to disable comparisons. + Exit status: 0 for a normal exit, 1 for environmental problems (file not found, invalid flags, I/O errors, etc), 2 to indicate a corrupt or @@ -706,21 +779,21 @@ Concept index Tag Table: Node: Top231 -Node: Introduction1278 -Node: Invoking lziprecover4395 -Ref: --trailing-error4860 -Node: Data safety10294 -Node: Repairing files12218 -Node: Merging files14120 -Node: File names15961 -Node: File format16425 -Node: Trailing data18854 -Node: Examples20230 -Ref: concat-example20661 -Ref: ddrescue-example21725 -Node: Unzcrash23015 -Node: Problems25571 -Node: Concept index26123 +Node: Introduction1267 +Node: Invoking lziprecover4525 +Ref: --trailing-error5175 +Node: Data safety11779 +Node: Repairing files13702 +Node: Merging files15602 +Node: File names17217 +Node: File format17681 +Node: Trailing data20109 +Node: Examples21492 +Ref: concat-example21923 +Ref: ddrescue-example22986 +Node: Unzcrash24276 +Node: Problems28786 +Node: Concept index29338 End Tag Table diff --git a/doc/lziprecover.texi b/doc/lziprecover.texi index e29a59f..2702d70 100644 --- a/doc/lziprecover.texi +++ b/doc/lziprecover.texi @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 16 September 2015 -@set VERSION 1.18-pre2 +@set UPDATED 12 May 2016 +@set VERSION 1.18 @dircategory Data Compression @direntry @@ -50,7 +50,7 @@ This manual is for Lziprecover (version @value{VERSION}, @value{UPDATED}). @end menu @sp 1 -Copyright @copyright{} 2009-2015 Antonio Diaz Diaz. +Copyright @copyright{} 2009-2016 Antonio Diaz Diaz. This manual is free documentation: you have unlimited permission to copy, distribute and modify it. @@ -66,6 +66,9 @@ files, produce a correct file by merging the good parts of two or more damaged copies, extract data from damaged files, decompress files and test integrity of files. +Lziprecover is not a replacement for regular backups, but a last line of +defense for the case where the backups are also damaged. + The lzip file format is designed for data sharing and long-term archiving, taking into account both data integrity and decoder availability: @@ -96,6 +99,10 @@ repair the nearer it is from the beginning of the file. Therefore, with the help of lziprecover, losing an entire archive just because of a corrupt byte near the beginning is a thing of the past. +For compressible data, multiple lzip-compressed copies have a better +chance of surviving intact than one uncompressed copy using the same +amount of storage space. + Lziprecover is able to recover or decompress files produced by any of the compressors in the lzip family; lzip, plzip, minilzip/lzlib, clzip and pdlzip. @@ -113,12 +120,11 @@ garbage data may be produced at the end of each member): lziprecover -D0 -i -o file -q file.lz @end example -Lziprecover is able to efficiently extract a range of bytes from a -multi-member file, because it only decompresses the members containing -the desired data. +Lziprecover provides random access to the data in multimember files; it +only decompresses the members containing the desired data. Lziprecover can print correct total file sizes and ratios even for -multi-member files. +multimember files. When recovering data, lziprecover takes as arguments the names of the damaged files and writes zero or more recovered files depending on the @@ -128,9 +134,6 @@ damaged files themselves are never modified. When decompressing or testing file integrity, lziprecover behaves like lzip or lunzip. -Lziprecover is not a replacement for regular backups, but a last line of -defense for the case where the backups are also damaged. - @node Invoking lziprecover @chapter Invoking lziprecover @@ -142,6 +145,11 @@ The format for running lziprecover is: lziprecover [@var{options}] [@var{files}] @end example +@noindent +When decompressing or testing, @samp{-} used as a @var{file} 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. + Lziprecover supports the following options: @table @code @@ -160,31 +168,54 @@ Exit with error status 2 if any remaining input is detected after decompressing the last member. Such remaining input is usually trailing garbage that can be safely ignored. @xref{concat-example}. +@item -A +@itemx --alone-to-lz +Convert lzma-alone files to lzip format without recompressing, just +adding a lzip header and trailer. The conversion minimizes the +dictionary size of the resulting file (and therefore the amount of +memory required to decompress it). Only streamed files with default LZMA +properties can be converted; non-streamed lzma-alone files lack the end +of stream marker required in lzip files. + +The name of the converted lzip file is derived from that of the original +lzma-alone file as follows: + +@multitable {filename.lzma} {becomes} {anyothername.lz} +@item filename.lzma @tab becomes @tab filename.lz +@item filename.tlz @tab becomes @tab filename.tar.lz +@item anyothername @tab becomes @tab anyothername.lz +@end multitable + @item -c @itemx --stdout -Decompress to standard output. Needed when reading from a named pipe -(fifo) or from a device. Use it to recover as much of the uncompressed -data as possible when decompressing a corrupt file. +Write decompressed data to standard output; keep input files unchanged. +This option is needed when reading from a named pipe (fifo) or from a +device. Use it also to recover as much of the uncompressed data as +possible when decompressing a corrupt file. @item -d @itemx --decompress -Decompress the specified file(s). If a file fails to decompress, -lziprecover exits immediately without decompressing the rest of the -files. +Decompress the specified file(s). If a file does not exist or can't be +opened, lziprecover continues decompressing the rest of the files. If a +file fails to decompress, lziprecover exits immediately without +decompressing the rest of the files. @item -D @var{range} @itemx --range-decompress=@var{range} Decompress only a range of bytes starting at decompressed byte position @samp{@var{begin}} and up to byte position @w{@samp{@var{end} - 1}}. -Three formats of @var{range} are recognized, @samp{@var{begin}}, -@samp{@var{begin}-@var{end}}, and @samp{@var{begin},@var{size}}. If only -@var{begin} is specified, @var{end} is taken as the end of the file. The -produced bytes are sent to standard output unless the @samp{--output} -option is used. In order to guarantee the correctness of the data -produced, all members containing any part of the desired data are -decompressed and their integrity is verified. This operation is more -efficient in multi-member files because it only decompresses the members -containing the desired data. +This option provides random access to the data in multimember files; it +only decompresses the members containing the desired data. In order to +guarantee the correctness of the data produced, all members containing +any part of the desired data are decompressed and their integrity is +verified. + +Four formats of @var{range} are recognized, @samp{@var{begin}}, +@samp{@var{begin}-@var{end}}, @samp{@var{begin},@var{size}}, and +@samp{,@var{size}}. If only @var{begin} is specified, @var{end} is taken +as the end of the file. If only @var{size} is specified, @var{begin} is +taken as the beginning of the file. The produced bytes are sent to +standard output unless the @samp{--output} option is used. @item -f @itemx --force @@ -194,7 +225,7 @@ Force overwrite of output files. @itemx --ignore-errors Make @samp{--range-decompress} ignore data errors and continue decompressing the remaining members in the file. For example, -@w{@samp{lziprecover -i -D0 file.lz > file}} decompresses all the +@w{@samp{lziprecover -D0 -i file.lz > file}} decompresses all the recoverable data in all members of @samp{file.lz} without having to split it first. @@ -205,8 +236,8 @@ Keep (don't delete) input files during decompression. @item -l @itemx --list Print total file sizes and ratios. The values produced are correct even -for multi-member files. Use it together with @samp{-v} to see -information about the members in the file. +for multimember files. Use it together with @samp{-v} to see information +about the members in the file. @item -m @itemx --merge @@ -223,7 +254,11 @@ Place the output into @samp{@var{file}} instead of into produced are in the form @samp{rec01@var{file}}, @samp{rec02@var{file}}, etc. If decompressing from standard input and @samp{--stdout} has not been specified, use @samp{@var{file}} as the name of the decompressed -file. +file. If converting a lzma-alone file from standard input and +@samp{--stdout} has not been specified, use @samp{@var{file}.lz} as the +name of the converted file. (Or plain @samp{@var{file}} if it already +ends in @samp{.lz} or @samp{.tlz}). + @item -q @itemx --quiet @@ -299,15 +334,15 @@ caused lziprecover to panic. @cindex data safety There are 3 main types of data corruption that may cause data loss: -single-byte errors, multi-byte errors (generally affecting a whole -sector in a block device), and total device failure. +single-byte errors, multibyte errors (generally affecting a whole sector +in a block device), and total device failure. Lziprecover protects natively against single-byte errors (@pxref{Repairing files}), as long as file integrity is checked frequently enough that a second single-byte error does not develop in the same member before the first one is repaired. -Lziprecover also protects against multi-byte errors (@pxref{Merging +Lziprecover also protects against multibyte errors (@pxref{Merging files}), if at least one backup copy of the file is made. The only remedy for total device failure is storing backup copies in @@ -326,11 +361,11 @@ If you used bzip2, and if the file is large enough to contain more than one compressed data block (usually larger than 900 kB uncompressed), and if no block is damaged in both files, then the data can be manually recovered by splitting the files with bzip2recover, verifying every -block and then copying the right blocks in the right order in another +block and then copying the right blocks in the right order into another file. But if you used lzip, the data can be automatically recovered as long as -no byte is damaged in both files. +the damaged areas don't overlap. Note that each error in a bzip2 file makes a whole block unusable, but each error in a lzip file only affects the damaged bytes, making it @@ -347,8 +382,8 @@ at all. If the reparation is successful, the repaired file will be identical bit for bit to the original. This makes lzip files resistant to bit-flip, one of the most common forms of data corruption. -The error may be located anywhere in the file except in the header -(first 6 bytes of each member) or in the @samp{Member size} field of the +The error may be located anywhere in the file except in the first 5 +bytes of each member header or in the @samp{Member size} field of the trailer (last 8 bytes of each member). If the error is in the header it can be easily repaired with a text editor like GNU Moe (@pxref{File format}). If the error is in the member size, it is enough to ignore the @@ -391,21 +426,14 @@ The merge will fail if the damaged areas overlap (at least one byte is damaged in all copies), or are adjacent and the boundary can't be determined, or if the copies have too many damaged areas. -All the copies must have the same size. If some of them have been -truncated and are therefore smaller than they should, they can be -extended to the correct size with the following command before merging -them with the other copies: +All the copies must have the same size. If any of them is larger or +smaller than it should, either because it has been truncated or because +it got some garbage data appended at the end, it can be brought to the +correct size with the following command before merging it with the other +copies: @example -ddrescue --extend-outfile=<correct_size> small_file.lz extended_file.lz -@end example - -If some of the copies have got garbage data at the end and are therefore -larger than they should, their sizes can be reduced to the correct value -with the following command before merging them with the other copies: - -@example -ddrescue --size=<correct_size> large_file.lz reduced_file.lz +ddrescue -s<correct_size> -x<correct_size> file.lz correct_size_file.lz @end example To give you an idea of its possibilities, when merging two copies, each @@ -461,7 +489,7 @@ additional information before, between, or after them. Each member has the following structure: @verbatim +--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -| ID string | VN | DS | Lzma stream | CRC32 | Data size | Member size | +| ID string | VN | DS | LZMA stream | CRC32 | Data size | Member size | +--+--+--+--+----+----+=============+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ @end verbatim @@ -485,8 +513,8 @@ 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 +@item LZMA stream +The LZMA stream, finished by an end of stream marker. Uses default values for encoder properties. @ifnothtml @xref{Stream format,,,lzip}, @@ -506,7 +534,7 @@ Size of the uncompressed original data. @item Member size (8 bytes) Total size of the member, including header and trailer. This field acts as a distributed index, allows the verification of stream integrity, and -facilitates safe recovery of undamaged members from multi-member files. +facilitates safe recovery of undamaged members from multimember files. @end table @@ -536,7 +564,7 @@ hash value (for a chosen hash) coincide with those of another file. @item In very rare cases, trailing data could be the corrupt header of another -member. In multi-member or concatenated files the probability of +member. In multimember or concatenated files the probability of corruption happening in the magic bytes is 5 times smaller than the probability of getting a false positive caused by the corruption of the integrity information itself. Therefore it can be considered to be below @@ -544,8 +572,8 @@ the noise level. @end itemize Trailing data can be safely ignored in most cases. In some cases, like -user-added data, it is expected to be ignored. In those cases where a -file containing trailing data must be rejected, the option +that of user-added data, it is expected to be ignored. In those cases +where a file containing trailing data must be rejected, the option @samp{--trailing-error} can be used. @xref{--trailing-error}. @@ -616,7 +644,7 @@ mv file_fixed.lz file.lz @sp 1 @noindent -Example 7: Split the multi-member file @samp{file.lz} and write each +Example 7: Split the multimember file @samp{file.lz} and write each member in its own @samp{recXXXfile.lz} file. Then use @w{@samp{lziprecover -t}} to test the integrity of the resulting files. @@ -681,10 +709,22 @@ test robustness to decompression of corrupted data, inspired by unzcrash.c from Julian Seward's bzip2. Type @samp{make unzcrash} in the lziprecover source directory to build it. -Unzcrash reads the specified file and then repeatedly decompresses it, -increasing 256 times each byte of the compressed data, so as to test all -possible one-byte errors. This should not cause any invalid memory -accesses. If it does, please, report it as a bug. +By default, unzcrash reads the specified file and then repeatedly +decompresses it, increasing 256 times each byte of the compressed data, +so as to test all possible one-byte errors. + +If the @code{--block} option is given, unzcrash reads the specified file +and then repeatedly decompresses it, setting all bytes in each +successive block to the value given, so as to test all possible full +sector errors. + +If the @code{--truncate} option is given, unzcrash reads the specified +file and then repeatedly decompresses it, truncating the file to +increasing lengths, so as to test all possible truncation points. + +None of the three test modes described above should cause any invalid +memory accesses. If any of them does, please, report it as a bug to the +maintainers of the decompressor being tested. Unzcrash really executes as a subprocess the shell command specified in the first non-option argument, and then writes the file specified in the @@ -693,6 +733,27 @@ modifying the corresponding byte each time. Therefore unzcrash can be used to test any decompressor (not only lzip), or even other decoder programs having a suitable command line syntax. +If the decompressor returns with zero status, unzcrash compares the +output of the decompressor for the original and corrupt files. If the +outputs differ, it means that the decompressor returned a false +negative; it failed to recognize the corruption and produced garbage +output. The only exception is when a multimember file is truncated just +after the last byte of a member, producing a shorter but valid +compressed file. Except in this latter case, please, report any false +negative as a bug. + +In order to compare the outputs, unzcrash needs a @samp{zcmp} program +able to understand the format being tested. For example the one provided +by @samp{zutils}. +@ifnothtml +@xref{Zcmp,,,zutils}, +@end ifnothtml +@ifhtml +See +@uref{http://www.nongnu.org/zutils/manual/zutils_manual.html#Zcmp,,zcmp} +@end ifhtml + + The format for running unzcrash is: @example @@ -728,9 +789,21 @@ The number of N-bit errors per byte (N = 1 to 8) is: @item 1-3,5-8 @tab 1, 2, 3, 5, 6, 7 and 8 @end multitable +@item -B[@var{size}][,@var{value}] +@itemx --block[=@var{size}][,@var{value}] +Test block errors of given @var{size} aligned to a @var{size}-byte +boundary, simulating a whole sector I/O error. Block @var{size} defaults +to 512 bytes. @var{value} defaults to 0. + +@item -d @var{n} +@itemx --delta=@var{n} +Test only one of every @var{n} bytes, blocks or truncation sizes, +instead of all of them. + @item -p @var{bytes} @itemx --position=@var{bytes} -First byte position to test in the file. Defaults to 0. +First byte position to test in the file. Defaults to 0. Negative values +are relative to the end of the file. @item -q @itemx --quiet @@ -738,13 +811,24 @@ Quiet operation. Suppress all messages. @item -s @var{bytes} @itemx --size=@var{bytes} -Number of byte positions to test. If not specified, the whole file is -tested. +Number of byte positions to test. If not specified, the rest of the file +is tested (from @code{--position} to end of file). Negative values are +relative to the rest of the file. + +@item -t +@itemx --truncate +Test all possible truncation points in the range specified by +@code{--position} and @code{--size}. @item -v @itemx --verbose Verbose mode. +@item -z +@itemx --zcmp=<command> +Set zcmp command name and options. Defaults to @code{zcmp}. Use +@code{--zcmp=false} to disable comparisons. + @end table Exit status: 0 for a normal exit, 1 for environmental problems (file not |