Jim Meyering [Wed, 7 Apr 2010 06:52:09 +0000 (08:52 +0200)]
build: keep --version strictly up to date
Before this change, in development, gzip's --version output could lag
behind reality by a couple deltas or by a "-dirty" suffix. That would
lead to spurious failure of the new --version-$VERSION PATH cross-check.
* Makefile.am (version.c, version.h): New rules.
(BUILT_SOURCES): Set/append.
(noinst_LIBRARIES, noinst_libver_a_SOURCES): Define.
(gzip_LDADD): Add libver.a.
(DISTCLEANFILES): Define.
* gzip.c (license): Use Version, not VERSION.
Jim Meyering [Mon, 5 Apr 2010 18:56:19 +0000 (20:56 +0200)]
build: update gnulib submodule to latest, and adapt
* cfg.mk: Update to use new _sc_search_regexp interface. Run this:
perl -pi -e 's/\b_prohibit_regexp\b/_sc_search_regexp/;'
-e 's/\bmsg=/halt=/; s/\bre=/prohibit=/;' cfg.mk
and then adjust backslashes so they still line up.
* cfg.mk (local-checks-to-skip): Add new sc_texinfo_acronym, to skip it.
* msdos/tailor.c (fcalloc): Mark a diagnostic for translation, to
placate stricter syntax-check, even though no one uses this file.
Jim Meyering [Sat, 20 Mar 2010 12:05:58 +0000 (13:05 +0100)]
use assembly code matcher when possible
* configure.ac (ASCPPPOST): Backslash-escape "#" in AC_SUBST'd
variable, to keep make from seeing it as a comment-introducer.
Based on a patch by Petr Pisar.
* lib/Makefile.am (match.$(OBJEXT)): Use AM_V_GEN and AM_V_at.
* lib/match.c: Don't include <config.h>.
It would impede configure-time assembler test.
* .x-sc_require_config_h: Exempt lib/match.c from syntax-check.
* .x-sc_require_config_h_first: Likewise.
Jim Meyering [Fri, 19 Mar 2010 17:09:20 +0000 (18:09 +0100)]
do not use stat.st_mtime of a non-regular file
* gzip.c: Include "timespec.h".
(treat_stdin): Use st_mtime only from a regular file.
This matters at least on Cygwin 1.7.1-1, for which a stdin-pipe has
the mtime of /dev/null, rather than the gzip-documented-for-pipes
"current time". Reported by Denis Excoffier.
Jim Meyering [Sat, 20 Feb 2010 10:07:55 +0000 (11:07 +0100)]
gzip: fix a data-loss bug when decompressing with --suffix=''
* gzip.c (main): Disallow an empty --suffix=S also with -d.
Otherwise, "gzip -d -S '' F.gz" would ask if it's ok to remove the
existing file, "F.gz"; if you reply "yes", you'd lose all of that data.
Use of an empty suffix was already rejected in compression mode.
* gzip.1 (--suffix (-S)): Do not recommend to use "gunzip -S '' *".
Describe how the suffix is used when decompressing, too.
* NEWS (Bug fixes): mention the fix.
Reported by Ripduman Sohan.
Mark Adler [Wed, 3 Feb 2010 09:11:33 +0000 (10:11 +0100)]
gzip -cdf now handles concatenation of gzip'd and uncompressed data
* util.c (copy): Change semantics so as to honor a decremented inptr.
* gzip.c (get_method): When needed (-cdf), decrement inptr rather
than clearing it -- and output the first magic byte.
Dmitry V. Levin [Sat, 30 Jan 2010 22:36:35 +0000 (22:36 +0000)]
zgrep: terminate gracefully when a pipeline is interrupted by a signal
zgrep is not terminated gracefully when its grep/sed pipeline
is terminated by a signal. For example, a command like
zgrep -F .TH /usr/share/man/man1/*.gz | head
continues working long after the "head" process completes.
Another example, a command like
zgrep unmatched-pattern /usr/share/man/man1/*.gz
cannot be interrupted by sending a SIGQUIT with Ctrl-\ key, it outputs
zgrep: line 221: test: : integer expression expected
and goes on.
* zgrep.in: Terminate gracefully when the grep/sed pipeline is
terminated by a signal.
* tests/zgrep-signal: New test.
* Makefile.am (TESTS): Add it.
Dmitry V. Levin [Mon, 1 Feb 2010 21:40:41 +0000 (00:40 +0300)]
wrapper scripts: write diagnostics to stderr, not to stdout
* zforce.in: In case of usage error, output short error diagnostics to
stderr instead of printing help text to stdout.
* zmore.in: Likewise.
* znew.in: Likewise.
Jim Meyering [Mon, 1 Feb 2010 12:34:46 +0000 (13:34 +0100)]
tests: remove unnecessary use of "path_prepend_ ."
It is unnecessary, since Makefile.am's TESTS_ENVIRONMENT setting
already adds the top build directory, and besides, is only
marginally useful when running stand-alone, since it presumes
that the script is being run from the top build directory.
* tests/helin-segv: Remove unnecessary use of path_prepend_.
* tests/memcpy-abuse: Likewise.
* tests/trailing-nul: Likewise.
* tests/zdiff: Likewise.
* tests/zgrep-f: Likewise.
Jim Meyering [Mon, 11 Jan 2010 10:51:13 +0000 (11:51 +0100)]
build: do not override gnulib-provided AM_CFLAGS options
Avoid a warning from automake:
lib/Makefile.am:24: AM_CFLAGS multiply defined in condition TRUE ...
lib/gnulib.mk:30: ... `AM_CFLAGS' previously defined here
lib/Makefile.am:20: `lib/gnulib.mk' included from here
* lib/Makefile.am (AM_CFLAGS): Append $(WARN_CFLAGS) and
$(WERROR_CFLAGS), i.e., use "+=", not "=".
This was introduced via 2009-12-17 commit 0341fc22,
"build: with --enable-gcc-warnings, use -Werror",
but fortunately is not a bug, because the definition
it would have overridden was always empty.
Jim Meyering [Sun, 10 Jan 2010 19:53:10 +0000 (20:53 +0100)]
gzip -d would fail with a CRC error...
...for some inputs, and some memcpy implementations. It is possible
that an offending input has to be compressed "from FAT filesystem
(MS-DOS, OS/2, NT)", since the sole reproducer no longer evokes a
CRC error when uncompressed and recompressed on a GNU/Linux system.
Also, using an unpatched reverse-memcpy-gzip on over 100,000 inputs
on a GNU/Linux system did not turn up another reproducer.
* inflate.c (inflate_codes): Don't call memcpy with overlapping regions.
Properly detect when source and destination overlap.
* tests/memcpy-abuse: New test, to trigger misbehavior.
* Makefile.am (TESTS): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Alain Magloire in
http://thread.gmane.org/gmane.comp.gnu.gzip.bugs/307
Jim Meyering [Fri, 8 Jan 2010 18:18:37 +0000 (19:18 +0100)]
tests: switch to gnulib's init.sh test infrastructure
* tests/test-lib.sh: Remove file.
* tests/init.sh: New file, from gnulib.
* tests/trailing-nul: Use the new file.
* tests/zdiff: Likewise.
* tests/zgrep-f: Likewise.
* Makefile.am (EXTRA_DIST): List tests/init.sh, not test-lib.sh.
Jim Meyering [Fri, 20 Nov 2009 17:54:38 +0000 (18:54 +0100)]
build: util.c: avoid warnings about add_envopt
* util.c (add_envopt): The parameter "env" was used for two conflicting
purposes. One use required a const char* parameter, while the other
was used as an argument to free, which must not be "const".
Rename the parameter and use a new local variable for the second role.
Jim Meyering [Fri, 20 Nov 2009 17:32:28 +0000 (18:32 +0100)]
build: avoid many const-related warnings
* gzip.c: Add "const" to many variables, to avoid compiler warnings.
* util.c (add_envopt): Make 3rd parameter const
(gzip_error): Make sole parameter const.
* gzip.h: Update prototypes.
* cfg.mk (gnu_ftp_host-alpha, gnu_ftp_host-beta gnu_ftp_host-stable):
(gnu_rel_host, url_dir_list): Remove definitions. The defaults,
now provided by maint.mk, are the same.
* gnulib: Update for latest, including those maint.mk additions.
Jim Meyering [Fri, 30 Oct 2009 18:52:17 +0000 (19:52 +0100)]
build: accommodate new syntax-check test
* amiga/tailor.c (_expand_args): Change each of three uses of
"exit(20)" to "exit(EXIT_FAILURE)".
* sample/add.c: Include <stdlib.h>.
(main): Use EXIT_FAILURE and EXIT_SUCCESS, not 1 and 0.
* sample/sub.c (main): Likewise.
* sample/zread.c (main): Likewise.
Jim Meyering [Fri, 30 Oct 2009 18:38:00 +0000 (19:38 +0100)]
build: link with $(LIB_CLOCK_GETTIME)
* Makefile.am (gzip_LDADD): Add $(LIB_CLOCK_GETTIME), now that
utimens pulls in gettime.
(FILES_TO_CHECK): Remove $(gzip_LDADD), now that it may contain -lrt.
Jim Meyering [Tue, 20 Oct 2009 11:21:21 +0000 (13:21 +0200)]
build: do not use AC_PREFIX_PROGRAM
* configure.ac: Do not use "AC_PREFIX_PROGRAM(gzip)".
It would induce behavior that is so surprising that it is probably
universally considered to be buggy, these days. Reported by Zube
in http://thread.gmane.org/gmane.comp.gnu.gzip.bugs/273
Jim Meyering [Fri, 9 Oct 2009 18:03:09 +0000 (20:03 +0200)]
zgrep: portability improvements; exercise "-f -"
* zgrep.in: Adjust loop not to use seq; it's not portable enough.
Fail if we don't find a free file descriptor.
(exists): New function; Use it in place of less portable "test -e".
Testing for existence of /dev/fd/$fd doesn't work on Solaris 10,
since all 256 always exist (as char devices), but testing for
/proc/$$/fd/$fd does work, so do that instead.
* Makefile.am (TESTS): Add tests/zgrep-f.
* tests/zgrep-f: New test; exercise this bug.
* NEWS (Bug fixes): Mention it.
Carl Worth [Fri, 9 Oct 2009 15:32:48 +0000 (17:32 +0200)]
zgrep: handle "-f -" the same way that it works with grep
Before this change, echo needle|zgrep -f - haystack.gz would not work.
* zgrep.in: When the pattern comes from stdin, redirect it to a
different file descriptor, since we're about to use stdin.
Jim Meyering [Fri, 9 Oct 2009 10:37:05 +0000 (12:37 +0200)]
zdiff would exit 2 (error) rather than 1 for differences
* zdiff.in: Save and restore cmp's exit status around a case
statement that would otherwise clobber its value.
* NEWS (Bug fixes): Mention it.
* tests/zdiff: New test; exercise both bugs.
* tests/test-lib.sh: New file. From coreutils.
* Makefile.am (EXTRA_DIST): Add tests/test-lib.sh.
(TESTS): Add tests/zdiff.
(TESTS_ENVIRONMENT): Define. From coreutils.
(EXTRA_DIST): Append all $(TESTS).
Jim Meyering [Fri, 9 Oct 2009 10:28:56 +0000 (12:28 +0200)]
zdiff: fix malfunction when operating on two gzip'd inputs
zdiff would fail to print differences in two compressed inputs
* zdiff.in: Don't let cmp output mix with echo'd gzip exit
status values. Report and fix from Jörg-Volker Peetz via
<http://bugs.debian.org/434275>
* NEWS (Bug fixes): Mention it.
Karl Berry [Mon, 28 Sep 2009 09:10:16 +0000 (11:10 +0200)]
doc: update gzip.texi
* doc/gzip.texi: FDL 1.3+
Consistently (de)capitalize section names.
"User's" is not correct; seems best to simplify the title.
Throw in some "GNU"'s.
Make direntries be what we actually want.
Detabify.
Jim Meyering [Sat, 26 Sep 2009 19:22:02 +0000 (21:22 +0200)]
gzip: don't use an uninitialized file descriptor
gzip interprets an argument of "-" as indicating stdin, but when
"-" is not the first name on the command line, it doesn't work.
* gzip.c (treat_stdin): Initialize "ifd".
Patch and fine description by Lasse Collin in
http://www.mail-archive.com/bug-gzip@gnu.org/msg00213.html
* Makefile.am (check-local): Exercise the fix. Based on the above.
* NEWS (Bug fixes): Mention this.