>From 7b9903e502657d6f6bf0ae8465a6397a5d0ed9a7 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sat, 5 Mar 2016 17:18:59 -0800 Subject: [PATCH 1/2] gzip: remove --__bindir * NEWS: Document this. * gzexe.in, gunzip.in, zcat.in, zcmp.in, zdiff.in, zegrep.in: * zfgrep.in, zforce.in, zgrep.in, zless.in, zmore.in, znew.in: Remove support for undocumented --__bindir option. Callers can set PATH instead; that's less error-prone. This fixes some 'make check' failures on my Solaris 11 box, which occurred because the test scripts were mistakenly testing the installed gzip rather than the gzip in the working directory. * Makefile.am (.in): Don't replace bindir. (check-local): Set PATH instead of using --__bindir. * tests/help-version (gunzip_setuphelp, gzexe_setuphelp) (zcat_setuphelp, zcmp_setuphelp, zdiff_setuphelp) (zegrep_setuphelp, zfgrep_setuphelp, zforce_setuphelp) (zgrep_setuphelp, zless_setuphelp, zmore_setuphelp) (znew_setuphelp): Remove. All uses removed. (lbracket_setup): Default args to empty. --- Makefile.am | 22 +++++++++++----------- NEWS | 6 ++++++ gunzip.in | 6 ------ gzexe.in | 7 ------- tests/help-version | 32 +++++++------------------------- zcat.in | 6 ------ zcmp.in | 8 +------- zdiff.in | 6 ------ zegrep.in | 7 +------ zfgrep.in | 7 +------ zforce.in | 6 ------ zgrep.in | 6 ------ zless.in | 6 ------ zmore.in | 6 ------ znew.in | 6 ------ 15 files changed, 27 insertions(+), 110 deletions(-) diff --git a/Makefile.am b/Makefile.am index b01ddee..8fb17b9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -82,7 +82,6 @@ SUFFIXES = .in .in: $(AM_V_GEN)sed \ -e 's|/bin/sh|$(SHELL)|g' \ - -e 's|address@hidden@|'\''$(bindir)'\''|g' \ -e 's|address@hidden@|$(GREP)|g' \ -e 's|address@hidden@|$(VERSION)|g' \ $(srcdir)/address@hidden >address@hidden \ @@ -108,17 +107,18 @@ gen-ChangeLog: FILES_TO_CHECK = $(bin_SCRIPTS) \ $(top_srcdir)/ChangeLog $(top_srcdir)/configure $(top_srcdir)/gzip.c check-local: $(FILES_TO_CHECK) $(bin_PROGRAMS) gzip.doc.gz - $(AM_V_GEN){ test '$(srcdir)' != . \ - || ./zdiff --__bindir . -c gzip.doc.gz; } - $(AM_V_at)./zdiff --__bindir . -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc - $(AM_V_at)./zdiff --__bindir . $(srcdir)/gzip.doc gzip.doc.gz - $(AM_V_at)./zdiff --__bindir . -c - $(srcdir)/gzip.doc /dev/null - $(AM_V_at)for opt in --rsyncable '' -1 -9; do \ + $(AM_V_GEN)PATH=.:$$PATH; { test '$(srcdir)' != . \ + || zdiff -c gzip.doc.gz; } + $(AM_V_at)PATH=.:$$PATH; zdiff -c $(srcdir)/gzip.doc $(srcdir)/gzip.doc + $(AM_V_at)PATH=.:$$PATH; zdiff $(srcdir)/gzip.doc gzip.doc.gz + $(AM_V_at)PATH=.:$$PATH; zdiff -c - $(srcdir)/gzip.doc /dev/null + $(AM_V_at)PATH=.:$$PATH; \ + for opt in --rsyncable '' -1 -9; do \ for file in $(FILES_TO_CHECK); do \ - ./gzip $$opt -c -- "$$file" \ - | ./gzip -d | cmp - "$$file" || exit 1; \ + gzip $$opt -c -- "$$file" \ + | gzip -d | cmp - "$$file" || exit 1; \ done; \ done diff --git a/NEWS b/NEWS index e3815d1..6363d71 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,12 @@ GNU gzip NEWS -*- outline -*- it is used, and rejects attempts to use dangerous options or operands. You can use an alias or script instead. + Installed programs like 'zgrep' now use the PATH environment variable + as usual to find subsidiary programs like 'gzip' and 'grep'. + Previously they prepended the installation directory to the PATH, + which sometimes caused 'make check' to test the wrong gzip executable. + [bug introduced in gzip-1.3.13] + ** New features gzip now accepts the --synchronous option, which causes it to use diff --git a/gunzip.in b/gunzip.in index d7edb53..1346b35 100644 --- a/gunzip.in +++ b/gunzip.in @@ -17,12 +17,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH - version="gunzip (gzip) @VERSION@ Copyright (C) 2007, 2011-2016 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of diff --git a/gzexe.in b/gzexe.in index 6b61ec4..b333993 100644 --- a/gzexe.in +++ b/gzexe.in @@ -53,13 +53,6 @@ Rename each FILE with a compressed version of itself, renaming FILE to FILE~. Report bugs to ." - address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH - decomp=0 res=0 while :; do diff --git a/tests/help-version b/tests/help-version index 00b4c34..5af9a05 100755 --- a/tests/help-version +++ b/tests/help-version @@ -55,19 +55,6 @@ expected_failure_status_grep=2 expected_failure_status_egrep=2 expected_failure_status_fgrep=2 -gunzip_setuphelp () { args="--__bindir '$abs_top_builddir'"; } -gzexe_setuphelp () { gunzip_setuphelp; } -zcat_setuphelp () { gunzip_setuphelp; } -zcmp_setuphelp () { gunzip_setuphelp; } -zdiff_setuphelp () { gunzip_setuphelp; } -zegrep_setuphelp () { gunzip_setuphelp; } -zfgrep_setuphelp () { gunzip_setuphelp; } -zforce_setuphelp () { gunzip_setuphelp; } -zgrep_setuphelp () { gunzip_setuphelp; } -zless_setuphelp () { gunzip_setuphelp; } -zmore_setuphelp () { gunzip_setuphelp; } -znew_setuphelp () { gunzip_setuphelp; } - test "$built_programs" \ || fail_ "built_programs not specified!?!" @@ -97,11 +84,7 @@ for lang in C fr da; do continue fi - if type ${i}_setuphelp > /dev/null 2>&1; then - ${i}_setuphelp - else - args= - fi + args= # The just-built install executable is always named `ginstall'. test $i = install && i=ginstall @@ -170,18 +153,18 @@ cmp_setup () { args="$tmp_in $tmp_in2"; } # The transfer rate would vary between runs. dd_setup () { args=status=noxfer; } -zdiff_setup () { gunzip_setuphelp; args="$args $zin $zin2"; } +zdiff_setup () { args="$args $zin $zin2"; } zcmp_setup () { zdiff_setup; } -zcat_setup () { gunzip_setuphelp; args="$args $zin"; } +zcat_setup () { args="$args $zin"; } gunzip_setup () { zcat_setup; } zmore_setup () { zcat_setup; } zless_setup () { zcat_setup; } -znew_setup () { gunzip_setuphelp; args="$args $bigZ_in"; } +znew_setup () { args="$args $bigZ_in"; } zforce_setup () { zcat_setup; } -zgrep_setup () { gunzip_setuphelp; args="$args z $zin"; } +zgrep_setup () { args="$args z $zin"; } zegrep_setup () { zgrep_setup; } zfgrep_setup () { zgrep_setup; } -gzexe_setup () { gunzip_setuphelp; args="$args $tmp_in"; } +gzexe_setup () { args="$args $tmp_in"; } # We know that $tmp_in contains a "0" grep_setup () { args="0 $tmp_in"; } @@ -271,10 +254,9 @@ for i in $built_programs; do mkdir $tmp_dir # echo ================== $i test $i = [ && prog=lbracket || prog=$i + args= if type ${prog}_setup > /dev/null 2>&1; then ${prog}_setup - else - args= fi if eval "env \$i $args < \$tmp_in > \$tmp_out"; then : # ok diff --git a/zcat.in b/zcat.in index d8ffd85..54befb4 100644 --- a/zcat.in +++ b/zcat.in @@ -17,12 +17,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH - version="zcat (gzip) @VERSION@ Copyright (C) 2007, 2011-2016 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of diff --git a/zcmp.in b/zcmp.in index d099223..eeee247 100644 --- a/zcmp.in +++ b/zcmp.in @@ -17,12 +17,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH - version="zcmp (gzip) @VERSION@ Copyright (C) 2010 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of @@ -48,4 +42,4 @@ case $1 in --version) echo "$version" || st=2; exit $st;; esac -exec zdiff --__bindir "$bindir" --__cmp "$@" +exec zdiff --__cmp "$@" diff --git a/zdiff.in b/zdiff.in index f1fa95f..f2f5435 100644 --- a/zdiff.in +++ b/zdiff.in @@ -18,12 +18,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH - case $1 in --__cmp) shift prog=cmp; cmp='${CMP-cmp}' ;; diff --git a/zegrep.in b/zegrep.in index 99855ef..e5969b7 100644 --- a/zegrep.in +++ b/zegrep.in @@ -1,7 +1,2 @@ #!/bin/sh address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH -exec zgrep --__bindir "$bindir" -E "$@" +exec zgrep -E "$@" diff --git a/zfgrep.in b/zfgrep.in index df17201..fd7be2b 100644 --- a/zfgrep.in +++ b/zfgrep.in @@ -1,7 +1,2 @@ #!/bin/sh address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH -exec zgrep --__bindir "$bindir" -F "$@" +exec zgrep -F "$@" diff --git a/zforce.in b/zforce.in index 5baff07..82ad330 100644 --- a/zforce.in +++ b/zforce.in @@ -23,12 +23,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH; export PATH - version="zforce (gzip) @VERSION@ Copyright (C) 2010-2016 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of diff --git a/zgrep.in b/zgrep.in index d94b8d8..0ad1b8a 100644 --- a/zgrep.in +++ b/zgrep.in @@ -22,12 +22,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH - grep='${GREP-'\''@GREP@'\''}' version='zgrep (gzip) @VERSION@ diff --git a/zless.in b/zless.in index a3edcc7..e634af6 100644 --- a/zless.in +++ b/zless.in @@ -16,12 +16,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH; export PATH - version="zless (gzip) @VERSION@ Copyright (C) 2007, 2011-2016 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of diff --git a/zmore.in b/zmore.in index b1bb68f..0193a1b 100644 --- a/zmore.in +++ b/zmore.in @@ -17,12 +17,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH; export PATH - version="zmore (gzip) @VERSION@ Copyright (C) 2010-2016 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of diff --git a/znew.in b/znew.in index ec025d2..12f89fc 100644 --- a/znew.in +++ b/znew.in @@ -18,12 +18,6 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. address@hidden@ -case $1 in ---__bindir) bindir=${2?}; shift; shift;; -esac -PATH=$bindir:$PATH; export PATH - version="znew (gzip) @VERSION@ Copyright (C) 2010-2016 Free Software Foundation, Inc. This is free software. You may redistribute copies of it under the terms of -- 2.5.0