bug-gzip
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 3/3] tests: work even if non-GNU gzip is installed in /usr/local/


From: Paul Eggert
Subject: [PATCH 3/3] tests: work even if non-GNU gzip is installed in /usr/local/bin
Date: Wed, 10 Apr 2013 15:33:33 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4

On 04/10/13 09:29, Antonio Diaz Diaz wrote:

> I think the problem is in the way gzip scripts try to locate executables.

Thanks for tracking it down.  I see the problem now.  Gzip uses a
different style of finding executables, where one can copy
an executable to a different directory without changing its behavior,
so I applied this fix instead.  If it doesn't fix your problem please
let me know.

===

Problem reported by Antonio Diaz Diaz in
<http://lists.gnu.org/archive/html/bug-gzip/2013-04/msg00004.html>.
* tests/help-version (zdiff_setup, zcat_setup, znew_setup, zgrep_setup)
(gzexe_setup): Pass --__bindir so that subsidiary programs are our
own's, not /usr/local/bin's.  This requires using 'eval' on the result.
(zcmp_setup, gunzip_setup, zmore_setup, zless_setup, zforce_setup)
(zegrep_setup, zfgrep_setup): Invoke one of the other setup functions,
to make the patterns more obvious and simplify future maintenance.
* zcmp.in, zegrep.in, zfgrep.in: Pass __bindir to subsidiary program.
---
 tests/help-version | 26 +++++++++++++-------------
 zcmp.in            |  2 +-
 zegrep.in          |  2 +-
 zfgrep.in          |  2 +-
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/tests/help-version b/tests/help-version
index 24f16f9..695b384 100755
--- a/tests/help-version
+++ b/tests/help-version
@@ -151,18 +151,18 @@ cmp_setup () { args="$tmp_in $tmp_in2"; }
 # The transfer rate would vary between runs.
 dd_setup () { args=status=noxfer; }
 
-zdiff_setup () { args="$zin $zin2"; }
-zcmp_setup () { args="$zin $zin2"; }
-zcat_setup () { args=$zin; }
-gunzip_setup () { args=$zin; }
-zmore_setup () { args=$zin; }
-zless_setup () { args=$zin; }
-znew_setup () { args=$bigZ_in; }
-zforce_setup () { args=$zin; }
-zgrep_setup () { args="z $zin"; }
-zegrep_setup () { args="z $zin"; }
-zfgrep_setup () { args="z $zin"; }
-gzexe_setup () { args=$tmp_in; }
+zdiff_setup () { args="--__bindir '$abs_top_builddir' $zin $zin2"; }
+zcmp_setup () { zdiff_setup; }
+zcat_setup () { args="--__bindir '$abs_top_builddir' $zin"; }
+gunzip_setup () { zcat_setup; }
+zmore_setup () { zcat_setup; }
+zless_setup () { zcat_setup; }
+znew_setup () { args="--__bindir '$abs_top_builddir' $bigZ_in"; }
+zforce_setup () { zcat_setup; }
+zgrep_setup () { args="--__bindir '$abs_top_builddir' z $zin"; }
+zegrep_setup () { zgrep_setup; }
+zfgrep_setup () { zgrep_setup; }
+gzexe_setup () { args="--__bindir '$abs_top_builddir' $tmp_in"; }
 
 # We know that $tmp_in contains a "0"
 grep_setup () { args="0 $tmp_in"; }
@@ -257,7 +257,7 @@ for i in $built_programs; do
   else
     args=
   fi
-  if env $i $args < $tmp_in > $tmp_out; then
+  if eval "env \$i $args < \$tmp_in > \$tmp_out"; then
     : # ok
   else
     echo FAIL: $i
diff --git a/zcmp.in b/zcmp.in
index 3752cc1..28b9350 100644
--- a/zcmp.in
+++ b/zcmp.in
@@ -48,4 +48,4 @@ case $1 in
 --version) echo "$version" || st=2; exit $st;;
 esac
 
-exec zdiff --__cmp "$@"
+exec zdiff --__bindir "$bindir" --__cmp "$@"
diff --git a/zegrep.in b/zegrep.in
index 800210f..99855ef 100644
--- a/zegrep.in
+++ b/zegrep.in
@@ -4,4 +4,4 @@ case $1 in
 --__bindir) bindir=${2?}; shift; shift;;
 esac
 PATH=$bindir:$PATH
-exec zgrep -E "$@"
+exec zgrep --__bindir "$bindir" -E "$@"
diff --git a/zfgrep.in b/zfgrep.in
index c458d96..df17201 100644
--- a/zfgrep.in
+++ b/zfgrep.in
@@ -4,4 +4,4 @@ case $1 in
 --__bindir) bindir=${2?}; shift; shift;;
 esac
 PATH=$bindir:$PATH
-exec zgrep -F "$@"
+exec zgrep --__bindir "$bindir" -F "$@"
-- 
1.7.11.7





reply via email to

[Prev in Thread] Current Thread [Next in Thread]