Subject: Re: bin/25310: tar can't unpack MS-DOS gzip files correctly
To: None <juan@xtraeme.unixbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 04/25/2004 17:39:16
On Sun, 25 Apr 2004, juan@xtraeme.unixbsd.org wrote:
> 	NetBSD -current is not able to decompress some .tar.gz files,
> 	as for example unpacking pkgsrc/textproc/crimson's distfile.

Does this help?  (See also PR 25200; the attempted fix for that
could be what broke this.)

Index: src/bin/pax/tar.c
--- tar.c	20 Apr 2004 19:59:54 -0000	1.51
+++ tar.c	23 Apr 2004 18:11:03 -0000
@@ -135,7 +135,7 @@
 off_t
 tar_endrd(void)
 {
-	return((off_t)(NULLCNT*BLKMULT));
+	return((off_t)((is_gnutar ? 1 : NULLCNT)*BLKMULT));
 }
 
 /*
@@ -178,15 +178,11 @@
 	 */
 	if (!in_resync) {
 		++*cnt;
-#if 0
 		/*
 		 * old GNU tar (up through 1.13) only writes one block of
-		 * trailers, so we pretend we got another
+		 * trailers, so we accept that for compatibility.
 		 */
-		if (is_gnutar)
-			++*cnt;
-#endif
-		if (*cnt >= NULLCNT)
+		if (is_gnutar || *cnt >= NULLCNT)
 			return(0);
 	}
 	return(1);