bug-gzip
[Top][All Lists]
Advanced

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

Re: gzip-1.3.10 test failures


From: Paul Eggert
Subject: Re: gzip-1.3.10 test failures
Date: Thu, 04 Jan 2007 00:12:26 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

"Nelson H. F. Beebe" <address@hidden> writes:

> Today, I attempted to repeat this success with the new gzip-1.3.10,
> but got failures like this on Sun Solaris 7 SPARC, SGI IRIX MIPS, DEC
> Alpha OSF/1 systems:
>
>       ./zdiff -c gzip.doc.gz gzip.doc.gz
>       diff: /dev/fd/3: Bad file number
>
> The problem in each case is that the script begins with "#!/bin/bash",
> but /bin/bash does not exist on two of those systems.

Can you please investigate why the script begins with #!/bin/bash?
'configure' should not be substituting a shell that does not exist.

My guess is that this problem also existed in gzip 1.3.9, but was
masked because the shell script happened to work with the fallback
/bin/sh.  That's still a bug, and we should fix it, since it's likely
to cause other scripts to not work.

Perhaps you built the script on a host that has /bin/bash, but ran it
on a host that lacks /bin/bash?  That might explain the problem; in
this case it would be an installation error.  You can work around this
problem by specifying CONFIG_SHELL to some POSIXish shell that exists
on all your hosts, e.g.,

   CONFIG_SHELL=/bin/ksh /bin/ksh ./configure CONFIG_SHELL=/bin/ksh

(Sorry that the syntax is so awkward.)

> On the other system, Solaris 8, /bin/bash exists and is
> version 2.03, which is apparently too old to recognize /dev/fd.

I looked into this, and Solaris 8 /bin/bash is buggy.  It apparently
opens file descriptor 3 with a close-on-exec bit, which defeats the
3<&0 redirection.

Can you please try the following patch?  It works around the problem.
I hope it fixes the problems on all the platforms that you mention,
though I've tested it only on Solaris 8.

I'm CC'ing this to Thomas Koutcher, as it supersedes the zdiff.in
patch I sent him a few hours ago for a different problem on Tru64.

Thanks.

2007-01-04  Paul Eggert  <address@hidden>

        * zdiff.in (cmp0): New var.
        Rewrite test for /dev/fd/3 to detect bugs in Solaris 8
        /bin/bash 2.03.  Problem reported by Nelson H. F. Beebe in
        <http://lists.gnu.org/archive/html/bug-gzip/2007-01/msg00001.html>.
        Avoid "for file; do", which doesn't work with Solaris 8 /bin/sh.

--- zdiff.in    24 Dec 2006 04:14:57 -0000      1.6
+++ zdiff.in    4 Jan 2007 08:03:20 -0000       1.8
@@ -14,6 +14,7 @@ case "$0" in
   *cmp) prog=cmp ; cmp='${CMP-cmp}'  ;;
   *)    prog=diff; cmp='${DIFF-diff}';;
 esac
+cmp0=$cmp
 
 version="z$prog (gzip) @VERSION@
 Copyright (C) 2006 Free Software Foundation, Inc.
@@ -45,7 +46,8 @@ while :; do
 done
 cmp="$cmp --"
 
-for file; do
+for file
+do
   test "X$file" = X- || <"$file" || exit 2
 done
 
@@ -65,7 +67,12 @@ elif test $# -eq 2; then
                *[-.]gz* | *[-.][zZ] | *.t[ga]z | -)
                    if test "$1$2" = --; then
                        gzip -cdfq - | eval "$cmp" - -
-                   elif test -r /dev/fd/3 3</dev/null; then
+                   elif
+                       # Reject Solaris 8's buggy /bin/bash 2.03.
+                       echo X |
+                        (echo X | eval "$cmp0" /dev/fd/3 - >/dev/null 2>&1) \
+                               3<&0
+                   then
                        gzip -cdfq -- "$1" |
                          (gzip -cdfq -- "$2" |
                           eval "$cmp" /dev/fd/3 -) 3<&0




reply via email to

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