bug-gzip
[Top][All Lists]
Advanced

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

Re: gzip 1.3.6 broken on Tandem NSK/OSS


From: Paul Eggert
Subject: Re: gzip 1.3.6 broken on Tandem NSK/OSS
Date: Tue, 05 Dec 2006 20:08:07 -0800
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux)

Matthew Woehlke <address@hidden> writes:

> gzip 1.3.6 does not build on Tandem NSK/OSS because it uses fchdir,
> which does not exist on NSK/OSS. This was added in gzip 1.3.5. Is
> there a replacement for this function (e.g. in gnulib)? Can its use be
> removed/conditionalized?

I looked into this some more, and decided that since all gzip uses
is fdopendir, it's overkill for gzip to bring in all of the openat
module.  Perhaps we should split out fdopendir into a separate
module?  But that'd be a tricky business, and right now I'm trying
to get a stable gzip out the door.  Besides, gzip should really
be using openat, as that is safer than the current approach.

For now I installed this patch to gzip.  This way, gzip doesn't use
openat.  It does use fdopendir if the underlying system has it,
though.  This lets gzip be safer on modern platforms (glibc 2.4,
Solaris 10) but less safe on older ones.  Since it's been less-safe
for a decade without anyone complaining, I guess that's good enough.

2006-12-05  Paul Eggert  <address@hidden>

        Port to Tandem NSK/OSS, which lacks fchdir.  Problem reported by
        Matthew Woehlke in
        <http://lists.gnu.org/archive/html/bug-gzip/2006-11/msg00013.html>.
        * bootstrap.conf (gnulib_modules): Remove openat, as it pulls in
        fchdir.
        * configure.ac: Check for fdopendir.
        * gzip.c: Don't include openat.h; no longer needed.
        (treat_dir) [!HAVE_FDOPENDIR]: Fall back on the old opendir method
        since fdopendir is not available.

Index: bootstrap.conf
===================================================================
RCS file: /cvsroot/gzip/gzip/bootstrap.conf,v
retrieving revision 1.2
diff -u -r1.2 bootstrap.conf
--- bootstrap.conf      5 Dec 2006 07:45:00 -0000       1.2
+++ bootstrap.conf      6 Dec 2006 04:01:54 -0000
@@ -23,7 +23,6 @@

 # gnulib modules used by this package.
 gnulib_modules='
-       openat
        fcntl
        fcntl-safer
        fdl
Index: configure.ac
===================================================================
RCS file: /cvsroot/gzip/gzip/configure.ac,v
retrieving revision 1.2
diff -u -r1.2 configure.ac
--- configure.ac        1 Dec 2006 20:52:52 -0000       1.2
+++ configure.ac        6 Dec 2006 04:01:54 -0000
@@ -79,7 +79,7 @@
 AC_C_CONST
 AC_HEADER_STDC
 AC_CHECK_HEADERS_ONCE(fcntl.h limits.h memory.h time.h)
-AC_CHECK_FUNCS_ONCE([fchmod fchown lstat])
+AC_CHECK_FUNCS_ONCE([fchmod fchown fdopendir lstat])
 AC_HEADER_DIRENT
 AC_TYPE_SIGNAL
 AC_TYPE_SIZE_T
Index: gzip.c
===================================================================
RCS file: /cvsroot/gzip/gzip/gzip.c,v
retrieving revision 1.6
diff -u -r1.6 gzip.c
--- gzip.c      5 Dec 2006 07:45:00 -0000       1.6
+++ gzip.c      6 Dec 2006 04:01:55 -0000
@@ -71,7 +71,6 @@

 #include "fcntl-safer.h"
 #include "getopt.h"
-#include "openat.h"
 #include "stat-time.h"

                /* configuration */
@@ -1759,11 +1758,18 @@
     char     nbuf[MAX_PATH_LEN];
     int      len;

+#if HAVE_FDOPENDIR
     dirp = fdopendir (fd);
+#else
+    close (fd);
+    dirp = opendir(dir);
+#endif

     if (dirp == NULL) {
        progerror(dir);
+#if HAVE_FDOPENDIR
        close (fd);
+#endif
        return ;
     }
     /*




reply via email to

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