Subject: Re: gzip and amanda conflict?
To: Peter Seebach <seebs@plethora.net>
From: Mike M. Volokhov <mishka@apk.od.ua>
List: current-users
Date: 09/19/2005 11:52:19
On Mon, 19 Sep 2005 02:09:40 -0500
seebs@plethora.net (Peter Seebach) wrote:

> In message <20050919095431.179a470f.mishka@apk.od.ua>, "Mike M. Volokhov" write
> s:
> >I.e. there are no room for reporting about more than 2^32=4G data.
> >Later this also badly affects on "gzip -l" for files with uncompressed
> >size more than specified volume. So...
> 
> So what?  It's been that way for ten years, easy.  I would rather have
> backups whose size is correctly reported than have them THROWN AWAY AND
> DESTROYED because some over-enthusiastic error reporting is biting me.

So, it must be fixed. :o)

Folks, could you please take a look at the quick patch below? Now, if
input data is great than 4G, gzip will produce warning only (with exit
code = 0) and will set uncompressed file size to zero rather junk.

Index: gzip.c
===================================================================
RCS file: /usr/home/mishka/NetBSD-CVS/src/usr.bin/gzip/gzip.c,v
retrieving revision 1.76
diff -u -r1.76 gzip.c
--- gzip.c	15 Sep 2005 18:51:33 -0000	1.76
+++ gzip.c	19 Sep 2005 08:44:50 -0000
@@ -626,6 +626,12 @@
 		goto out;
 	}
 
+	if (in_tot > 0xffffffff) {
+		in_tot = 0;
+		errno = EFBIG;
+		if (qflag == 0)
+			warn("warning: input file size >= 4GB");
+	}
 	i = snprintf(outbufp, BUFLEN, "%c%c%c%c%c%c%c%c", 
 		 (int)crc & 0xff,
 		 (int)(crc >> 8) & 0xff,
@@ -637,8 +643,6 @@
 		 (int)(in_tot >> 24) & 0xff);
 	if (i != 8)
 		maybe_err("snprintf");
-	if (in_tot > 0xffffffff)
-		maybe_warn("input file size >= 4GB cannot be saved");
 	if (write(out, outbufp, i) != i) {
 		maybe_warn("write");
 		in_tot = -1;

And what do you think about GNU implementation changes mentioned by
Matthew?

--
Mishka.