* Makefile.am (.in): Substitute @bindir@, not BINDIR, for

consistency with other substitutions.
(check-local): Use --__bindir . rather than setting GZIP_BINDIR=.,
to allay security concerns voiced by Joerg Lehners in
<http://lists.gnu.org/archive/html/bug-gzip/2007-04/msg00003.html>.
* gunzip.in, gzexe.in, zcat.in, zcmp.in, zdiff.in, zegrep.in, zfgrep.in:
* zforce.in, zgrep.in, zless.in, zmore.in, znew.in:
Support --__bindir rather than GZIP_BINDIR.

* gunzip.in, zcat.in, zcmp.in: Support --help and --version
directly, to avoid some confusion in help and version output.
Problem reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-gzip/2007-04/msg00006.html>.
This commit is contained in:
Paul Eggert 2007-05-04 19:53:25 +00:00
parent 79c3261c8b
commit 4858351c63
14 changed files with 230 additions and 19 deletions

View File

@ -1,3 +1,19 @@
2007-05-04 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.am (.in): Substitute @bindir@, not BINDIR, for
consistency with other substitutions.
(check-local): Use --__bindir . rather than setting GZIP_BINDIR=.,
to allay security concerns voiced by Joerg Lehners in
<http://lists.gnu.org/archive/html/bug-gzip/2007-04/msg00003.html>.
* gunzip.in, gzexe.in, zcat.in, zcmp.in, zdiff.in, zegrep.in, zfgrep.in:
* zforce.in, zgrep.in, zless.in, zmore.in, znew.in:
Support --__bindir rather than GZIP_BINDIR.
* gunzip.in, zcat.in, zcmp.in: Support --help and --version
directly, to avoid some confusion in help and version output.
Problem reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-gzip/2007-04/msg00006.html>.
2007-04-28 Paul Eggert <eggert@cs.ucla.edu>
* m4/shell.m4 (AC_PROG_SHELL): Check for old-fashioned shells that

View File

@ -56,7 +56,7 @@ SUFFIXES = .in
.in:
sed \
-e 's|/bin/sh|$(SHELL)|g' \
-e 's|BINDIR|$${GZIP_BINDIR-'\''$(bindir)'\''}|g' \
-e 's|[@]bindir@|'\''$(bindir)'\''|g' \
-e 's|[@]VERSION@|$(VERSION)|g' \
$(srcdir)/$@.in >$@
chmod a+x $@
@ -65,12 +65,12 @@ SUFFIXES = .in
FILES_TO_CHECK = $(bin_SCRIPTS) $(gzip_LDADD) \
$(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c
check-local: $(FILES_TO_CHECK) gzip.doc.gz
{ test '$(srcdir)' != . || GZIP_BINDIR=. ./zdiff -c gzip.doc.gz; }
GZIP_BINDIR=. ./zdiff -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
GZIP_BINDIR=. ./zdiff $(srcdir)/gzip.doc gzip.doc.gz
GZIP_BINDIR=. ./zdiff -c - $(srcdir)/gzip.doc <gzip.doc.gz
GZIP_BINDIR=. ./zdiff -c gzip.doc.gz gzip.doc.gz
GZIP_BINDIR=. ./zgrep -iV >/dev/null
{ test '$(srcdir)' != . || ./zdiff --__bindir . -c gzip.doc.gz; }
./zdiff --__bindir . -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc
./zdiff --__bindir . $(srcdir)/gzip.doc gzip.doc.gz
./zdiff --__bindir . -c - $(srcdir)/gzip.doc <gzip.doc.gz
./zdiff --__bindir . -c gzip.doc.gz gzip.doc.gz
./zgrep --__bindir . -iV >/dev/null
for file in $(FILES_TO_CHECK); do \
./gzip -cv -- "$$file" | ./gzip -d | cmp - "$$file" || exit; \
done

View File

@ -1,3 +1,61 @@
#!/bin/sh
PATH=BINDIR:$PATH
# Uncompress files. This is the inverse of gzip.
# Copyright (C) 2007 Free Software Foundation
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
version="gunzip (gzip) @VERSION@
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert."
usage="Usage: $0 [OPTION]... [FILE]...
Uncompress FILEs (by default, in-place).
Mandatory arguments to long options are mandatory for short options too.
-c, --stdout write on standard output, keep original files unchanged
-f, --force force overwrite of output file and compress links
-l, --list list compressed file contents
-n, --no-name do not save or restore the original name and time stamp
-N, --name save or restore the original name and time stamp
-q, --quiet suppress all warnings
-r, --recursive operate recursively on directories
-S, --suffix=SUF use suffix SUF on compressed files
-t, --test test compressed file integrity
-v, --verbose verbose mode
--help display this help and exit
--version display version information and exit
With no FILE, or when FILE is -, read standard input.
Report bugs to <bug-gzip@gnu.org>."
case $1 in
--help) exec echo "$usage";;
--version) exec echo "$version";;
esac
exec gzip -d "$@"

View File

@ -53,7 +53,11 @@ Rename each FILE with a compressed version of itself, renaming FILE to FILE~.
Report bugs to <bug-gzip@gnu.org>."
PATH="BINDIR:$PATH"
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
decomp=0
res=0

55
zcat.in
View File

@ -1,3 +1,56 @@
#!/bin/sh
PATH=BINDIR:$PATH
# Uncompress files to standard output.
# Copyright (C) 2007 Free Software Foundation
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
version="zcat (gzip) @VERSION@
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert."
usage="Usage: $0 [OPTION]... [FILE]...
Uncompress FILEs to standard output.
-f, --force force; read compressed data even from a terminal
-l, --list list compressed file contents
-q, --quiet suppress all warnings
-r, --recursive operate recursively on directories
-S, --suffix=SUF use suffix SUF on compressed files
-t, --test test compressed file integrity
-v, --verbose verbose mode
--help display this help and exit
--version display version information and exit
With no FILE, or when FILE is -, read standard input.
Report bugs to <bug-gzip@gnu.org>."
case $1 in
--help) exec echo "$usage";;
--version) exec echo "$version";;
esac
exec gzip -cd "$@"

49
zcmp.in
View File

@ -1,3 +1,50 @@
#!/bin/sh
PATH=BINDIR:$PATH
# Compare the uncompressed contents of compressed files, byte by byte.
# Copyright (C) 2007 Free Software Foundation
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
version="zcmp (gzip) @VERSION@
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
Written by Paul Eggert."
usage="Usage: $0 [OPTION]... FILE1 [FILE2]
Compare FILE1 to FILE2 byte by byte, using their uncompressed contents
if they are compressed. If FILE2 is omitted, compare FILE1 to the
uncompressed contents of FILE1.gz. Do comparisons like 'cmp' does.
Options are the same as for 'cmp'.
If a FILE is '-' or missing, read standard input.
Report bugs to <bug-gzip@gnu.org>."
case $1 in
--help) exec echo "$usage";;
--version) exec echo "$version";;
esac
exec zdiff --__cmp "$@"

View File

@ -18,7 +18,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
PATH=BINDIR:$PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
case $1 in
--__cmp) shift

View File

@ -1,3 +1,7 @@
#!/bin/sh
PATH=BINDIR:$PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
exec zgrep -E "$@"

View File

@ -1,3 +1,7 @@
#!/bin/sh
PATH=BINDIR:$PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
exec zgrep -F "$@"

View File

@ -23,7 +23,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
PATH="BINDIR:$PATH"; export PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH; export PATH
version="zforce (gzip) @VERSION@
Copyright (C) 2007 Free Software Foundation, Inc.

View File

@ -20,7 +20,12 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
PATH=BINDIR:$PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH
grep='${GREP-grep}'
version='zgrep (gzip) @VERSION@

View File

@ -16,7 +16,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
PATH="BINDIR:$PATH"; export PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH; export PATH
version="zless (gzip) @VERSION@
Copyright (C) 2007 Free Software Foundation, Inc.

View File

@ -17,7 +17,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
PATH="BINDIR:$PATH"; export PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH; export PATH
version="zmore (gzip) @VERSION@
Copyright (C) 2007 Free Software Foundation, Inc.

View File

@ -17,7 +17,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
PATH="BINDIR:$PATH"; export PATH
bindir=@bindir@
case $1 in
--__bindir) bindir=${2?}; shift; shift;;
esac
PATH=$bindir:$PATH; export PATH
version="znew (gzip) @VERSION@
Copyright (C) 2007 Free Software Foundation, Inc.