[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: gzip > 1.3.? broken on NSK
From: |
Paul Eggert |
Subject: |
Re: gzip > 1.3.? broken on NSK |
Date: |
Fri, 08 Dec 2006 17:30:51 -0800 |
User-agent: |
Gnus/5.1008 (Gnus v5.10.8) Emacs/21.4 (gnu/linux) |
Matthew Woehlke <address@hidden> writes:
> gzip is using 64k in file_read (zip.c), but SSIZE_MAX is 53248
> (52k).
Wow, that's a new one.
> We could
> limit the size to SSIZE_MAX, but I don't know how portable that
> is.
It's portable if you check that SSIZE_MAX is defined first.
Something like this:
# if defined SSIZE_MAX && SSIZE_MAX < INBUFSIZ
# undef INBUFSIZ
# define INBUFSIZ SSIZE_MAX
# endif
This should be good enough for OSF, whose maximum size is far greater
than INBUFSIZ.
> Alternatively, on all platforms I looked at, _POSIX_C_SOURCE (both
> existed, and) was 32k, so using that as a fixed value is probably OK
> (and obviously is no *less* safe than the current behavior).
Sorry, I don't follow this; what does _POSIX_C_SOURCE have to do with it?
I installed the following; this should fix all the NSK bugs you reported.
Can you please try it?
2006-12-08 Paul Eggert <address@hidden>
Fix problems in porting to NSK reported by Matthew Woehlke in
<http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00025.html> and
<http://lists.gnu.org/archive/html/bug-gzip/2006-12/msg00027.html>.
* gzip.h: Include <limits.h>, for SSIZE_MAX.
(INBUFSIZE): Don't make it any larger than SSIZE_MAX.
Problem reported by Matthew Woehlke in
<http://lists.gnu.org/archive/html/bug-gzip/2006-11/msg00013.html>.
* gzip.c: Don't include <limits.h>, as gzip.h now does this.
* util.c: Likewise.
* gzip.c (main): Set exiting_signal before installing signal handlers.
(install_signal_handlers): Don't set exiting_signal here. This
fixes a C99ism.
* zip.c: Include timespec.h, for time_stamp type.
Index: gzip.c
===================================================================
RCS file: /cvsroot/gzip/gzip/gzip.c,v
retrieving revision 1.8
diff -p -u -r1.8 gzip.c
--- gzip.c 7 Dec 2006 06:58:13 -0000 1.8
+++ gzip.c 9 Dec 2006 01:19:29 -0000
@@ -85,10 +85,6 @@ static char rcsid[] = "$Id: gzip.c,v 1.8
# include <fcntl.h>
#endif
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
-
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
@@ -539,6 +535,7 @@ int main (argc, argv)
ALLOC(ush, tab_prefix1, 1L<<(BITS-1));
#endif
+ exiting_signal = quiet ? SIGPIPE : 0;
install_signal_handlers ();
/* And get to work */
@@ -1780,8 +1777,6 @@ install_signal_handlers ()
int nsigs = sizeof sig / sizeof sig[0];
int i;
- exiting_signal = quiet ? SIGPIPE : 0;
-
#if SA_NOCLDSTOP
struct sigaction act;
Index: gzip.h
===================================================================
RCS file: /cvsroot/gzip/gzip/gzip.h,v
retrieving revision 1.4
diff -p -u -r1.4 gzip.h
--- gzip.h 20 Nov 2006 08:40:33 -0000 1.4
+++ gzip.h 9 Dec 2006 01:19:29 -0000
@@ -59,6 +59,10 @@
# define memzero(s, n) bzero((s), (n))
#endif
+#ifdef HAVE_LIMITS_H
+# include <limits.h>
+#endif
+
#ifndef RETSIGTYPE
# define RETSIGTYPE void
#endif
@@ -101,6 +105,10 @@ extern int method; /* compressio
# else
# define INBUFSIZ 0x8000 /* input buffer size */
# endif
+# if defined SSIZE_MAX && SSIZE_MAX < INBUFSIZ
+# undef INBUFSIZ
+# define INBUFSIZ SSIZE_MAX
+# endif
#endif
#define INBUF_EXTRA 64 /* required by unlzw() */
Index: util.c
===================================================================
RCS file: /cvsroot/gzip/gzip/util.c,v
retrieving revision 1.4
diff -p -u -r1.4 util.c
--- util.c 20 Nov 2006 08:40:34 -0000 1.4
+++ util.c 9 Dec 2006 01:19:29 -0000
@@ -1,6 +1,7 @@
/* util.c -- utility functions for gzip support
- Copyright (C) 1997, 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998, 1999, 2001, 2002, 2006 Free Software
+ Foundation, Inc.
Copyright (C) 1992-1993 Jean-loup Gailly
This program is free software; you can redistribute it and/or modify
@@ -27,9 +28,6 @@ static char rcsid[] = "$Id: util.c,v 1.4
#include "tailor.h"
-#ifdef HAVE_LIMITS_H
-# include <limits.h>
-#endif
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
Index: zip.c
===================================================================
RCS file: /cvsroot/gzip/gzip/zip.c,v
retrieving revision 1.4
diff -p -u -r1.4 zip.c
--- zip.c 20 Nov 2006 08:40:34 -0000 1.4
+++ zip.c 9 Dec 2006 01:19:29 -0000
@@ -28,6 +28,8 @@ static char rcsid[] = "$Id: zip.c,v 1.4
#include "gzip.h"
#include "crypt.h"
+#include "timespec.h"
+
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif