From 9fc73afc00c20648a602f45dc1df4843a9008f9b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 27 Jan 2021 17:15:45 +0100 Subject: Merging upstream version 1.10. Signed-off-by: Daniel Baumann --- ChangeLog | 18 +++++++++++++----- INSTALL | 8 +++++++- NEWS | 39 ++++++--------------------------------- README | 2 +- arg_parser.cc | 2 +- arg_parser.h | 2 +- configure | 6 +++--- doc/zcat.1 | 6 +++--- doc/zcmp.1 | 6 +++--- doc/zdiff.1 | 6 +++--- doc/zgrep.1 | 6 +++--- doc/ztest.1 | 6 +++--- doc/zupdate.1 | 10 +++++----- doc/zutils.info | 49 ++++++++++++++++++++++++++----------------------- doc/zutils.texi | 37 +++++++++++++++++++++---------------- rc.cc | 4 ++-- rc.h | 2 +- recursive.cc | 2 +- testsuite/check.sh | 10 +++++++++- zcat.cc | 4 ++-- zcatgrep.cc | 2 +- zcmp.cc | 2 +- zcmpdiff.cc | 2 +- zdiff.cc | 16 ++++++++-------- zgrep.cc | 4 ++-- ztest.cc | 2 +- zupdate.cc | 8 ++++---- zutils.cc | 2 +- zutils.h | 2 +- 29 files changed, 134 insertions(+), 131 deletions(-) diff --git a/ChangeLog b/ChangeLog index 895b2f4..cdbc3da 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,12 +1,20 @@ +2021-01-05 Antonio Diaz Diaz + + * Version 1.10 released. + * zdiff.cc (set_fifonames): Encode pid in little endian order. + * zupdate.cc (zupdate_file): Fix a portability issue with Solaris 10. + * zutils.texi: Document that 'zgrep -L' fails with GNU grep 3.2 to 3.4. + * check.sh: Test empty input files with all tools except zupdate. + 2020-06-27 Antonio Diaz Diaz * Version 1.9 released. - * zcmp.cc zdiff.cc: Read standard input only if requested. + * zcmp.cc, zdiff.cc: Read standard input only if requested. * zdiff.cc (main): Pass options '-W' and '-y' to diff. * zutils.cc (test_format): Detect bzip2 and lzip files better. * ztest.cc (main): Continue testing if any input file is a terminal. If verbosity >= 1, print number of files that failed the test. - * zcat.cc zgrep.cc ztest.cc (main): Check return value of close( infd ). + * zcat.cc, zgrep.cc, ztest.cc (main): Check return value of close(infd). * zutils.cc (good_status): Ignore trailing data remaining in feeder. * zupdate.cc (zupdate_file): Support new and old lzip option '-o'. Keep combined extensions: tgz, tbz, tbz2, txz --> tlz. @@ -47,7 +55,7 @@ * Version 1.5 released. * zupdate.cc (zupdate_file): Pass '-q' to zcmp if verbosity < 0. - * zcat.cc zgrep.cc ztest.cc (main): Don't use stdin more than once. + * zcat.cc, zgrep.cc, ztest.cc (main): Don't use stdin more than once. * zdiff.cc (set_fifonames): Use '_' if both names are different. * configure: Avoid warning on some shells when testing for g++. * Makefile.in: Detect the existence of install-info. @@ -92,7 +100,7 @@ * main.cc (main): Make 'grep_show_name' tri-state so that file name is no prefixed to output by default when searching one file and '--recursive' has not been selected. - * Zgrep: Fix output of option '-L' (it behaved like '-l'). + * zgrep.cc: Fix output of option '-L' (it behaved like '-l'). * zcmp.cc: Fix deadlock when option '-n' is used. * zdiff.cc (set_data_feeder): Call compressor with option '-q' only if verbosity < 0. @@ -172,7 +180,7 @@ * Version 0.1 released. -Copyright (C) 2009-2020 Antonio Diaz Diaz. +Copyright (C) 2009-2021 Antonio Diaz Diaz. This file is a collection of facts, and thus it is not copyrightable, but just in case, you have unlimited permission to copy, distribute, and diff --git a/INSTALL b/INSTALL index a56c227..3c9c429 100644 --- a/INSTALL +++ b/INSTALL @@ -5,6 +5,12 @@ I use gcc 6.1.0 and 4.1.2, but the code should compile with any standards compliant compiler. Gcc is available at http://gcc.gnu.org. +POSIX compliant versions of diff and grep are required for zdiff and zgrep. + +(Option -L of zgrep fails (prints wrong results, returns wrong status, and +even hangs) when using GNU grep versions 3.2 to 3.4 inclusive because of a +wrong change in the exit status of grep, which was reverted in GNU grep 3.5). + Compressors for bzip2, gzip and lzip formats are required to run the tests. If you are installing zutils along with GNU gzip and want to keep the @@ -69,7 +75,7 @@ After running 'configure', you can run 'make' and 'make install' as explained above. -Copyright (C) 2009-2020 Antonio Diaz Diaz. +Copyright (C) 2009-2021 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute, and modify it. diff --git a/NEWS b/NEWS index 5ea6cf0..4b62179 100644 --- a/NEWS +++ b/NEWS @@ -1,36 +1,9 @@ -Changes in version 1.9: +Changes in version 1.10: -zcmp anf zdiff now meet the POSIX requirement for cmp and diff that the -standard input shall be used only if the file1 or file2 operand refers to -standard input. +A portability issue with Solaris 10 has been fixed. -zdiff now passes the options '-W' and '-y' to diff. (But it only works if -the diff program used supports them). +It has been documented in the manual that 'zgrep -L' fails with GNU grep +versions 3.2 to 3.4 inclusive because of a wrong change reverted in GNU grep +3.5. -Bzip2 and lzip files are now detected better. -('echo LZIP | zcat' and 'echo BZh5 | zcat' no longer return an error). - -ztest now continues checking the rest of the files if any input file is a -terminal. - -'ztest -v' now prints the number of files that failed the test (like lzip). - -zcat, zgrep, and ztest now check for errors when closing the input file in -addition to checking when closing the input from the decompressor. - -Trailing data remaining in the data feeder to the decompressor are now -correctly ignored. - -zupdate has been modified to support the new behavior of lzip 1.22's option -'-o' while retaining: -perfect backwards compatibility with older versions of lzip down to 1.20, -good backwards compatibility with older versions of lzip down to 1.11, -acceptable backwards compatibility with older versions of lzip down to 1.4. - -zupdate now keeps combined extensions: tgz, tbz, tbz2, txz --> tlz. -This is useful when recompressing Slackware packages, for example. - -zupdate now puts single quotes around file names when calling zcmp to allow -file names with spaces. (But putting spaces in file names is a bad idea). - -The descriptions of zcat, zcmp, and zdiff have been improved. +'make check' now tests empty input files with all tools except zupdate. diff --git a/README b/README index 86ec037..8725fe3 100644 --- a/README +++ b/README @@ -37,7 +37,7 @@ been compressed. Decompressed is used to refer to data which have undergone the process of decompression. -Copyright (C) 2009-2020 Antonio Diaz Diaz. +Copyright (C) 2009-2021 Antonio Diaz Diaz. This file is free documentation: you have unlimited permission to copy, distribute, and modify it. diff --git a/arg_parser.cc b/arg_parser.cc index b843c09..2e40a13 100644 --- a/arg_parser.cc +++ b/arg_parser.cc @@ -1,5 +1,5 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C++ version) - Copyright (C) 2006-2020 Antonio Diaz Diaz. + Copyright (C) 2006-2021 Antonio Diaz Diaz. This library is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided diff --git a/arg_parser.h b/arg_parser.h index d9a4af0..5629b90 100644 --- a/arg_parser.h +++ b/arg_parser.h @@ -1,5 +1,5 @@ /* Arg_parser - POSIX/GNU command line argument parser. (C++ version) - Copyright (C) 2006-2020 Antonio Diaz Diaz. + Copyright (C) 2006-2021 Antonio Diaz Diaz. This library is free software. Redistribution and use in source and binary forms, with or without modification, are permitted provided diff --git a/configure b/configure index dfef6bc..48c7f81 100755 --- a/configure +++ b/configure @@ -1,12 +1,12 @@ #! /bin/sh # configure script for Zutils - Utilities dealing with compressed files -# Copyright (C) 2009-2020 Antonio Diaz Diaz. +# Copyright (C) 2009-2021 Antonio Diaz Diaz. # # This configure script is free software: you have unlimited permission # to copy, distribute, and modify it. pkgname=zutils -pkgversion=1.9 +pkgversion=1.10 srctrigger=doc/${pkgname}.texi # clear some things potentially inherited from environment. @@ -179,7 +179,7 @@ echo "GREP = ${GREP}" rm -f Makefile cat > Makefile << EOF # Makefile for Zutils - Utilities dealing with compressed files -# Copyright (C) 2009-2020 Antonio Diaz Diaz. +# Copyright (C) 2009-2021 Antonio Diaz Diaz. # This file was generated automatically by configure. Don't edit. # # This Makefile is free software: you have unlimited permission diff --git a/doc/zcat.1 b/doc/zcat.1 index 29966ad..fbaf821 100644 --- a/doc/zcat.1 +++ b/doc/zcat.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. -.TH ZCAT "1" "June 2020" "zcat (zutils) 1.9" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. +.TH ZCAT "1" "January 2021" "zutils 1.10" "User Commands" .SH NAME zcat \- decompress and concatenate files to standard output .SH SYNOPSIS @@ -96,7 +96,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2020 Antonio Diaz Diaz. +Copyright \(co 2021 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zcmp.1 b/doc/zcmp.1 index b11d79b..5ae5231 100644 --- a/doc/zcmp.1 +++ b/doc/zcmp.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. -.TH ZCMP "1" "June 2020" "zcmp (zutils) 1.9" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. +.TH ZCMP "1" "January 2021" "zutils 1.10" "User Commands" .SH NAME zcmp \- decompress and compare two files byte by byte .SH SYNOPSIS @@ -83,7 +83,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2020 Antonio Diaz Diaz. +Copyright \(co 2021 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zdiff.1 b/doc/zdiff.1 index 7d8d387..65a34b7 100644 --- a/doc/zdiff.1 +++ b/doc/zdiff.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. -.TH ZDIFF "1" "June 2020" "zdiff (zutils) 1.9" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. +.TH ZDIFF "1" "January 2021" "zutils 1.10" "User Commands" .SH NAME zdiff \- decompress and compare two files line by line .SH SYNOPSIS @@ -114,7 +114,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2020 Antonio Diaz Diaz. +Copyright \(co 2021 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zgrep.1 b/doc/zgrep.1 index 545aea2..69ed0cd 100644 --- a/doc/zgrep.1 +++ b/doc/zgrep.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. -.TH ZGREP "1" "June 2020" "zgrep (zutils) 1.9" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. +.TH ZGREP "1" "January 2021" "zutils 1.10" "User Commands" .SH NAME zgrep \- search compressed files for a regular expression .SH SYNOPSIS @@ -146,7 +146,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2020 Antonio Diaz Diaz. +Copyright \(co 2021 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/ztest.1 b/doc/ztest.1 index 431e40c..45cda27 100644 --- a/doc/ztest.1 +++ b/doc/ztest.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. -.TH ZTEST "1" "June 2020" "ztest (zutils) 1.9" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. +.TH ZTEST "1" "January 2021" "zutils 1.10" "User Commands" .SH NAME ztest \- verify the integrity of compressed files .SH SYNOPSIS @@ -75,7 +75,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2020 Antonio Diaz Diaz. +Copyright \(co 2021 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zupdate.1 b/doc/zupdate.1 index afa65d3..dcd3d24 100644 --- a/doc/zupdate.1 +++ b/doc/zupdate.1 @@ -1,5 +1,5 @@ -.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.46.1. -.TH ZUPDATE "1" "June 2020" "zupdate (zutils) 1.9" "User Commands" +.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.16. +.TH ZUPDATE "1" "January 2021" "zutils 1.10" "User Commands" .SH NAME zupdate \- recompress bzip2, gzip, xz files to lzip format .SH SYNOPSIS @@ -25,8 +25,8 @@ to be safe and not cause any data loss. Therefore, existing lzip compressed files are never overwritten nor deleted. .PP The names of the original files must have one of the following extensions: -\&'.bz2', '.gz', and '.xz' are recompressed to '.lz'. -\&'.tbz', '.tbz2', '.tgz', and '.txz' are recompressed to '.tlz'. +\&'.bz2', '.gz', or '.xz', which are recompressed to '.lz'; +\&'.tbz', '.tbz2', '.tgz', or '.txz', which are recompressed to '.tlz'. .PP Exit status is 0 if all the compressed files were successfully recompressed (if needed), compared, and deleted (if requested). Non\-zero otherwise. @@ -84,7 +84,7 @@ Report bugs to zutils\-bug@nongnu.org .br Zutils home page: http://www.nongnu.org/zutils/zutils.html .SH COPYRIGHT -Copyright \(co 2020 Antonio Diaz Diaz. +Copyright \(co 2021 Antonio Diaz Diaz. License GPLv2+: GNU GPL version 2 or later .br This is free software: you are free to change and redistribute it. diff --git a/doc/zutils.info b/doc/zutils.info index 2de6d3b..854100f 100644 --- a/doc/zutils.info +++ b/doc/zutils.info @@ -11,7 +11,7 @@ File: zutils.info, Node: Top, Next: Introduction, Up: (dir) Zutils Manual ************* -This manual is for Zutils (version 1.9, 27 June 2020). +This manual is for Zutils (version 1.10, 5 January 2021). * Menu: @@ -28,7 +28,7 @@ This manual is for Zutils (version 1.9, 27 June 2020). * Concept index:: Index of concepts - Copyright (C) 2009-2020 Antonio Diaz Diaz. + Copyright (C) 2009-2021 Antonio Diaz Diaz. This manual is free documentation: you have unlimited permission to copy, distribute, and modify it. @@ -162,16 +162,15 @@ here. *Note Argument syntax: (arg_parser)Argument syntax.  File: zutils.info, Node: The zutilsrc file, Next: Zcat, Prev: Common options, Up: Top -3 The zutilsrc file -******************* +3 The zutils configuration file 'zutilsrc' +****************************************** 'zutilsrc' is the runtime configuration file for zutils. In it you may -define the compressor name and options to be used for each format. The -'zutilsrc' file is optional; you don't need to install it in order to run -zutils. +define the compressor name and options to be used for each format. +'zutilsrc' is optional; you don't need to install it in order to run zutils. The compressors specified in the command line override those specified -in the 'zutilsrc' file. +in 'zutilsrc'. You may copy the system 'zutilsrc' file '${sysconfdir}/zutilsrc' to '$HOME/.zutilsrc' and customize these options as you like. The file syntax @@ -557,6 +556,10 @@ program used supports them): '-L' '--files-without-match' Only print names of files not containing any matches. + Note: option -L fails (prints wrong results, returns wrong status, and + even hangs) when using GNU grep versions 3.2 to 3.4 inclusive because + of a wrong change in the exit status of grep, which was reverted in + GNU grep 3.5. '-m N' '--max-count=N' @@ -709,8 +712,8 @@ pair of files in a multiformat set of files. The names of the original files must have one of the following extensions: -'.bz2', '.gz', and '.xz' are recompressed to '.lz'. -'.tbz', '.tbz2', '.tgz', and '.txz' are recompressed to '.tlz'. +'.bz2', '.gz', or '.xz', which are recompressed to '.lz'; +'.tbz', '.tbz2', '.tgz', or '.txz', which are recompressed to '.tlz'. Keeping the combined extensions ('.tgz' -> '.tlz') may be useful when recompressing Slackware packages, for example. @@ -802,30 +805,30 @@ Concept index * common options: Common options. (line 6) * getting help: Problems. (line 6) * introduction: Introduction. (line 6) -* the zutilsrc file: The zutilsrc file. (line 6) * zcat: Zcat. (line 6) * zcmp: Zcmp. (line 6) * zdiff: Zdiff. (line 6) * zgrep: Zgrep. (line 6) * ztest: Ztest. (line 6) * zupdate: Zupdate. (line 6) +* zutilsrc: The zutilsrc file. (line 6)  Tag Table: Node: Top222 -Node: Introduction1148 -Node: Common options3773 -Ref: compressor-requirements5844 -Node: The zutilsrc file6216 -Node: Zcat7149 -Node: Zcmp9712 -Node: Zdiff12202 -Node: Zgrep14942 -Node: Ztest18944 -Node: Zupdate21451 -Node: Problems25123 -Node: Concept index25657 +Node: Introduction1151 +Node: Common options3776 +Ref: compressor-requirements5847 +Node: The zutilsrc file6219 +Node: Zcat7180 +Node: Zcmp9743 +Node: Zdiff12233 +Node: Zgrep14973 +Node: Ztest19218 +Node: Zupdate21725 +Node: Problems25409 +Node: Concept index25943  End Tag Table diff --git a/doc/zutils.texi b/doc/zutils.texi index bb1c3b1..c494185 100644 --- a/doc/zutils.texi +++ b/doc/zutils.texi @@ -6,8 +6,8 @@ @finalout @c %**end of header -@set UPDATED 27 June 2020 -@set VERSION 1.9 +@set UPDATED 5 January 2021 +@set VERSION 1.10 @dircategory Data Compression @direntry @@ -29,6 +29,7 @@ @contents @end ifnothtml +@ifnottex @node Top @top @@ -49,10 +50,11 @@ This manual is for Zutils (version @value{VERSION}, @value{UPDATED}). @end menu @sp 1 -Copyright @copyright{} 2009-2020 Antonio Diaz Diaz. +Copyright @copyright{} 2009-2021 Antonio Diaz Diaz. This manual is free documentation: you have unlimited permission to copy, distribute, and modify it. +@end ifnottex @node Introduction @@ -194,21 +196,20 @@ It must return 0 if no errors occurred, and a non-zero value otherwise. @node The zutilsrc file -@chapter The zutilsrc file -@cindex the zutilsrc file +@chapter The zutils configuration file 'zutilsrc' +@cindex zutilsrc @file{zutilsrc} is the runtime configuration file for zutils. In it you may define the compressor name and options to be used for each format. -The @file{zutilsrc} file is optional; you don't need to install it in -order to run zutils. +@file{zutilsrc} is optional; you don't need to install it in order to run +zutils. The compressors specified in the command line override those specified -in the @file{zutilsrc} file. +in @file{zutilsrc}. -You may copy the system @file{zutilsrc} file -@file{$@{sysconfdir@}/zutilsrc} to @file{$HOME/.zutilsrc} and customize -these options as you like. The file syntax is fairly obvious (and there -are further instructions in it): +You may copy the system @file{zutilsrc} file @file{$@{sysconfdir@}/zutilsrc} +to @file{$HOME/.zutilsrc} and customize these options as you like. The file +syntax is fairly obvious (and there are further instructions in it): @enumerate @item @@ -623,7 +624,10 @@ Only print names of files containing at least one match. @item -L @itemx --files-without-match -Only print names of files not containing any matches. +Only print names of files not containing any matches.@* +Note: option -L fails (prints wrong results, returns wrong status, and even +hangs) when using GNU grep versions 3.2 to 3.4 inclusive because of a wrong +change in the exit status of grep, which was reverted in GNU grep 3.5. @item -m @var{n} @itemx --max-count=@var{n} @@ -783,9 +787,10 @@ Combining the options @samp{--force} and @samp{--keep}, as in between each pair of files in a multiformat set of files. The names of the original files must have one of the following extensions:@* -@samp{.bz2}, @samp{.gz}, and @samp{.xz} are recompressed to @samp{.lz}.@* -@samp{.tbz}, @samp{.tbz2}, @samp{.tgz}, and @samp{.txz} are recompressed to -@samp{.tlz}.@* +@samp{.bz2}, @samp{.gz}, or @samp{.xz}, which are recompressed to +@samp{.lz};@* +@samp{.tbz}, @samp{.tbz2}, @samp{.tgz}, or @samp{.txz}, which are +recompressed to @samp{.tlz}.@* Keeping the combined extensions (@samp{.tgz} --> @samp{.tlz}) may be useful when recompressing Slackware packages, for example. diff --git a/rc.cc b/rc.cc index 7ad51f4..0162510 100644 --- a/rc.cc +++ b/rc.cc @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009-2020 Antonio Diaz Diaz. + Copyright (C) 2009-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,7 +37,7 @@ int verbosity = 0; namespace { const char * const config_file_name = "zutilsrc"; -const char * const program_year = "2020"; +const char * const program_year = "2021"; std::string compressor_names[num_formats] = { "bzip2", "gzip", "lzip", "xz" }; // default compressor names diff --git a/rc.h b/rc.h index db04bcd..38a737e 100644 --- a/rc.h +++ b/rc.h @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009-2020 Antonio Diaz Diaz. + Copyright (C) 2009-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/recursive.cc b/recursive.cc index 1b77a28..a69e117 100644 --- a/recursive.cc +++ b/recursive.cc @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009-2020 Antonio Diaz Diaz. + Copyright (C) 2009-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/testsuite/check.sh b/testsuite/check.sh index 27b1a51..6a6ef38 100755 --- a/testsuite/check.sh +++ b/testsuite/check.sh @@ -1,6 +1,6 @@ #! /bin/sh # check script for Zutils - Utilities dealing with compressed files -# Copyright (C) 2009-2020 Antonio Diaz Diaz. +# Copyright (C) 2009-2021 Antonio Diaz Diaz. # # This script is free software: you have unlimited permission # to copy, distribute, and modify it. @@ -56,6 +56,7 @@ cat in in in in in in > in6 || framework_failure bad0_lz="${testdir}"/zero_bad_crc.lz bad0_gz="${testdir}"/zero_bad_crc.gz bad1_lz="${testdir}"/test_bad_crc.lz +touch empty empty.bz2 empty.gz empty.lz fail=0 test_failed() { fail=1 ; printf " $1" ; [ -z "$2" ] || printf "($2)" ; } @@ -64,6 +65,8 @@ printf "testing zcat-%s..." "$2" for i in ${extensions}; do "${ZCAT}" -N in.$i > copy || test_failed $LINENO $i cmp in copy || test_failed $LINENO $i + "${ZCAT}" -N empty.$i in.$i > copy || test_failed $LINENO $i + cmp in copy || test_failed $LINENO $i "${ZCAT}" -N --format=un in.$i > copy || test_failed $LINENO $i cmp in copy || test_failed $LINENO $i "${ZCAT}" -N --force-format=$i in.$i > copy || test_failed $LINENO $i @@ -145,6 +148,7 @@ for i in ${extensions}; do "${ZCMP}" -N in.$i in --force-format=$i || test_failed $LINENO $i "${ZCMP}" -N -i 1kB:1000 -n 500 in6 in.$i || test_failed $LINENO $i "${ZCMP}" -N -i 1KiB:1024 -n 50 in.$i in6 || test_failed $LINENO $i + "${ZCMP}" -N empty empty.$i || test_failed $LINENO $i done "${ZCMP}" -Nq in in6 @@ -216,6 +220,7 @@ for i in ${extensions}; do "${ZDIFF}" -N in.$i in > /dev/null || test_failed $LINENO $i "${ZDIFF}" -N in.$i in --force-format=$i, > /dev/null || test_failed $LINENO $i + "${ZDIFF}" -N empty empty.$i > /dev/null || test_failed $LINENO $i done "${ZDIFF}" -N in in6 > /dev/null @@ -293,6 +298,7 @@ for i in ${extensions}; do test_failed $LINENO $i "${ZGREP}" -N --force-format=$i "GNU" in 2> /dev/null [ $? = 2 ] || test_failed $LINENO $i + "${ZGREP}" -N "nx_pattern" empty.$i && test_failed $LINENO $i done "${ZGREP}" -N pin.tar -e "GNU" > /dev/null || test_failed $LINENO @@ -358,6 +364,7 @@ done "${ZTEST}" -N -r || test_failed $LINENO "${ZTEST}" -N -R . || test_failed $LINENO "${ZTEST}" -N -R || test_failed $LINENO +"${ZTEST}" -N empty empty.bz2 empty.gz empty.lz || test_failed $LINENO "${ZTEST}" -Nq in.gz "${bad0_lz}" in.bz2 "${bad1_lz}" in.lz [ $? = 2 ] || test_failed $LINENO @@ -532,6 +539,7 @@ rm -f tmp3/a.lz || framework_failure cd .. || framework_failure rm -r tmp2 || framework_failure +rm -f empty empty.bz2 empty.gz empty.lz || framework_failure if ln -s '.' slink 2> /dev/null ; then "${ZCAT}" -N -r slink > /dev/null || test_failed $LINENO "${ZGREP}" -N -r "GNU" slink > /dev/null || test_failed $LINENO diff --git a/zcat.cc b/zcat.cc index f852c74..62b93aa 100644 --- a/zcat.cc +++ b/zcat.cc @@ -1,5 +1,5 @@ /* Zcat - decompress and concatenate files to standard output - Copyright (C) 2010-2020 Antonio Diaz Diaz. + Copyright (C) 2010-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -75,7 +75,7 @@ public: str[i] = '0'; } if( first_digit_pos > 0 ) str[--first_digit_pos] = '1'; - else str.insert( first_digit_pos, 1, '1' ); + else str.insert( str.begin() + first_digit_pos, '1' ); } int sprint( uint8_t * const buf ) diff --git a/zcatgrep.cc b/zcatgrep.cc index 0d16cb3..31d54e6 100644 --- a/zcatgrep.cc +++ b/zcatgrep.cc @@ -1,5 +1,5 @@ /* Common code for zcat and zgrep - Copyright (C) 2010-2020 Antonio Diaz Diaz. + Copyright (C) 2010-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zcmp.cc b/zcmp.cc index b97d5ef..9daa1b9 100644 --- a/zcmp.cc +++ b/zcmp.cc @@ -1,5 +1,5 @@ /* Zcmp - decompress and compare two files byte by byte - Copyright (C) 2010-2020 Antonio Diaz Diaz. + Copyright (C) 2010-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zcmpdiff.cc b/zcmpdiff.cc index 153b232..fceb8cf 100644 --- a/zcmpdiff.cc +++ b/zcmpdiff.cc @@ -1,5 +1,5 @@ /* Common code for zcmp and zdiff - Copyright (C) 2010-2020 Antonio Diaz Diaz. + Copyright (C) 2010-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zdiff.cc b/zdiff.cc index 9312253..a173971 100644 --- a/zdiff.cc +++ b/zdiff.cc @@ -1,5 +1,5 @@ /* Zdiff - decompress and compare two files line by line - Copyright (C) 2010-2020 Antonio Diaz Diaz. + Copyright (C) 2010-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -116,7 +116,8 @@ extern "C" void remove_fifos() /* Set fifonames[i] to "${TMPDIR}/[_-]" - and create FIFOs. */ + and create FIFOs. The pid is coded in little endian order. +*/ bool set_fifonames( const std::string filenames[2] ) { enum { num_codes = 36 }; @@ -126,13 +127,12 @@ bool set_fifonames( const std::string filenames[2] ) if( p ) { fifonames[0] = p; fifonames[0] += '/'; } else fifonames[0] = "/tmp/"; int n = getpid(); - unsigned pos = fifonames[0].size(); - do fifonames[0].insert( pos, 1, codes[n % num_codes] ); - while( n /= num_codes ); - pos = fifonames[0].size(); + do fifonames[0] += codes[n % num_codes]; while( n /= num_codes ); + const unsigned pos = fifonames[0].size(); + fifonames[0] += '_'; fifonames[1] = fifonames[0]; - fifonames[0] += '_'; fifonames[0] += my_basename( filenames[0].c_str() ); - fifonames[1] += '_'; fifonames[1] += my_basename( filenames[1].c_str() ); + fifonames[0] += my_basename( filenames[0].c_str() ); + fifonames[1] += my_basename( filenames[1].c_str() ); if( fifonames[1] == fifonames[0] ) fifonames[1][pos] = '-'; for( int i = 0; i < 2; ++i ) diff --git a/zgrep.cc b/zgrep.cc index 01c6b07..1454e77 100644 --- a/zgrep.cc +++ b/zgrep.cc @@ -1,5 +1,5 @@ /* Zgrep - search compressed files for a regular expression - Copyright (C) 2010-2020 Antonio Diaz Diaz. + Copyright (C) 2010-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -195,7 +195,7 @@ int zgrep_file( int infd, const int format_index, { std::fflush( stdout ); show_error( "Write error", errno ); return 2; } std::fflush( stdout ); } - if( size < buffer_size ) break; + if( size < buffer_size ) break; // end of grep's output } int retval = wait_for_child( grep_pid, GREP ); diff --git a/ztest.cc b/ztest.cc index a059a5b..812278e 100644 --- a/ztest.cc +++ b/ztest.cc @@ -1,5 +1,5 @@ /* Ztest - verify the integrity of compressed files - Copyright (C) 2010-2020 Antonio Diaz Diaz. + Copyright (C) 2010-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zupdate.cc b/zupdate.cc index cc0ffde..a605f35 100644 --- a/zupdate.cc +++ b/zupdate.cc @@ -1,5 +1,5 @@ /* Zupdate - recompress bzip2, gzip, xz files to lzip format - Copyright (C) 2013-2020 Antonio Diaz Diaz. + Copyright (C) 2013-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -67,8 +67,8 @@ void show_help() "to be safe and not cause any data loss. Therefore, existing lzip\n" "compressed files are never overwritten nor deleted.\n" "\nThe names of the original files must have one of the following extensions:\n" - "'.bz2', '.gz', and '.xz' are recompressed to '.lz'.\n" - "'.tbz', '.tbz2', '.tgz', and '.txz' are recompressed to '.tlz'.\n" + "'.bz2', '.gz', or '.xz', which are recompressed to '.lz';\n" + "'.tbz', '.tbz2', '.tgz', or '.txz', which are recompressed to '.tlz'.\n" "\nUsage: zupdate [options] [files]\n" "\nExit status is 0 if all the compressed files were successfully recompressed\n" "(if needed), compared, and deleted (if requested). Non-zero otherwise.\n" @@ -280,7 +280,7 @@ int zupdate_file( const std::string & name, const char * const lzip_name, std::string zcmp_command( invocation_name ); unsigned i = zcmp_command.size(); while( i > 0 && zcmp_command[i-1] != '/' ) --i; - zcmp_command.resize( i ); zcmp_command.insert( 0U, 1, '\'' ); + zcmp_command.resize( i ); zcmp_command.insert( zcmp_command.begin(), '\'' ); zcmp_command += "zcmp' "; // '[dir/]zcmp' if( no_rcfile ) zcmp_command += "-N "; if( verbosity < 0 ) zcmp_command += "-q "; diff --git a/zutils.cc b/zutils.cc index 6090c0a..54090ff 100644 --- a/zutils.cc +++ b/zutils.cc @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009-2020 Antonio Diaz Diaz. + Copyright (C) 2009-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/zutils.h b/zutils.h index ef7248a..064af51 100644 --- a/zutils.h +++ b/zutils.h @@ -1,5 +1,5 @@ /* Zutils - Utilities dealing with compressed files - Copyright (C) 2009-2020 Antonio Diaz Diaz. + Copyright (C) 2009-2021 Antonio Diaz Diaz. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -- cgit v1.2.3