From archie@packetdesign.com  Mon Jan 27 09:30:54 2003
Return-Path: <archie@packetdesign.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 944D237B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Jan 2003 09:30:54 -0800 (PST)
Received: from mailman.packetdesign.com (dns.packetdesign.net [65.192.41.10])
	by mx1.FreeBSD.org (Postfix) with ESMTP id C29D043ED8
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Jan 2003 09:30:53 -0800 (PST)
	(envelope-from archie@packetdesign.com)
Received: from bubba.packetdesign.com (bubba.packetdesign.com [192.168.0.223])
	by mailman.packetdesign.com (8.12.6/8.12.3) with ESMTP id h0RHUmdu072427
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Jan 2003 09:30:48 -0800 (PST)
	(envelope-from archie@packetdesign.com)
Received: from bubba.packetdesign.com (localhost [127.0.0.1])
	by bubba.packetdesign.com (8.12.6/8.12.6) with ESMTP id h0RHUmIp065968
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 27 Jan 2003 09:30:48 -0800 (PST)
	(envelope-from archie@bubba.packetdesign.com)
Received: (from archie@localhost)
	by bubba.packetdesign.com (8.12.6/8.12.6/Submit) id h0RHUmvn065967;
	Mon, 27 Jan 2003 09:30:48 -0800 (PST)
Message-Id: <200301271730.h0RHUmvn065967@bubba.packetdesign.com>
Date: Mon, 27 Jan 2003 09:30:48 -0800 (PST)
From: Archie Cobbs <archie@packetdesign.com>
Reply-To: Archie Cobbs <archie@packetdesign.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: tar 'z' option gzip'd output has extra garbage
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         47560
>Category:       bin
>Synopsis:       tar 'z' option gzip'd output has extra garbage
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kientzle
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 27 09:40:04 PST 2003
>Closed-Date:    Sun Apr 04 11:46:38 PDT 2004
>Last-Modified:  Sun Apr 04 11:46:38 PDT 2004
>Originator:     Archie Cobbs
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
Packet Design
>Environment:
System: FreeBSD bubba.packetdesign.com 4.7-STABLE FreeBSD 4.7-STABLE #0: Fri Dec 13 10:11:46 PST 2002 archie@bubba.packetdesign.com:/usr/obj/usr/src/sys/BUBBA i386

>Description:

    'tar cvfz - empty' produces bogus gzip output that has extra
    trailing garbage. This does not corrupt the files but causes
    an error when unpacking.

    'tar cvf - empty | gzip' works fine however.

>How-To-Repeat:

    $ touch empty
    $ tar cvf - empty | gzip | gunzip | md5
    empty
    99a6f2c50591dcebf15eac62ef80b3de
    $ tar cvfz - empty | gunzip | md5
    empty

    gunzip: stdin: decompression OK, trailing garbage ignored
    99a6f2c50591dcebf15eac62ef80b3de
    $ tar cvfz - empty | hd
    empty
    0000000: 1f 8b 08 00 d5 6b 35 3e 00 03 ed ce 3d 0a c2 40  .....k5>....=..@
    0000010: 18 04 d0 3d ca 1e e1 5b d9 9f f3 04 09 68 21 84  ...=...[.....h!.
    0000020: 18 0b 6f af 08 82 8d 58 c5 ea bd 66 8a 99 62 e6  ..o....X...f..b.
    0000030: cb b2 dd d3 be a2 44 f4 5a 53 44 94 d1 e2 33 df  ......D.ZSD...3.
    0000040: 52 8c 5e da a1 b7 11 e5 b9 2f 35 46 ca b1 f3 af  R.^....../5F....
    0000050: 97 db 75 9b d6 9c d3 b4 1e 4f e7 f9 fb ee 57 0f  ..u......O....W.
    0000060: 00 00 00 00 00 00 00 00 00 7f f4 00 5d 5a 6d 79  ............]Zmy
    0000070: 00 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .(..............
    0000080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
    *
    $ tar cvf - empty |  gzip | hd
    empty
    0000000: 1f 8b 08 00 e1 6b 35 3e 00 03 ed ce 3d 0a c2 40  .....k5>....=..@
    0000010: 18 04 d0 3d ca 1e e1 5b d9 9f f3 04 09 68 21 84  ...=...[.....h!.
    0000020: 18 0b 6f af 08 82 8d 58 c5 ea bd 66 8a 99 62 e6  ..o....X...f..b.
    0000030: cb b2 dd d3 be a2 44 f4 5a 53 44 94 d1 e2 33 df  ......D.ZSD...3.
    0000040: 52 8c 5e da a1 b7 11 e5 b9 2f 35 46 ca b1 f3 af  R.^....../5F....
    0000050: 97 db 75 9b d6 9c d3 b4 1e 4f e7 f9 fb ee 57 0f  ..u......O....W.
    0000060: 00 00 00 00 00 00 00 00 00 7f f4 00 5d 5a 6d 79  ............]Zmy
    0000070: 00 28 00 00                                      .(..

    Notice the extra zeroes in the first output.

>Fix:


>Release-Note:
>Audit-Trail:

From: Yar Tikhiy <yar@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org, archie@packetdesign.com
Cc:  
Subject: Re: bin/47560: tar 'z' option gzip'd output has extra garbage
Date: Wed, 26 Nov 2003 16:35:52 +0300

 This seems to be an undocumented feature (i.e., a bug) of GNU tar
 itself.  If writing a compressed archive to anything but a plain
 file, GNU tar will zero pad it to the next block boundary (10K by
 default.)  I think documenting this feature in the FreeBSD tar(1)
 manpage will be sufficient to close this PR.
 
 -- 
 Yar

From: Tim Kientzle <tim@kientzle.com>
To: freebsd-gnats-submit@FreeBSD.org, archie@packetdesign.com
Cc:  
Subject: Re: bin/47560: tar 'z' option gzip'd output has extra garbage
Date: Sun, 04 Apr 2004 10:45:45 -0700

 This behavior is by design.
 
 Archives written to tape, floppy, or other block devices
 must be padded to a full block size.  In the case
 of stdout, tar cannot know the final destination, so
 it conservatively assumes the padding is necessary.
 
 When writing directly to a regular file
 
    tar cvzf file.tgz
 
 the padding is not added, as tar can correctly
 determine that it is not necessary.
 
 My 'bsdtar' implementation behaves the same way
 for the same reasons.
 
State-Changed-From-To: open->closed 
State-Changed-By: kientzle 
State-Changed-When: Sun Apr 4 11:45:00 PDT 2004 
State-Changed-Why:  

Not a bug. 


Responsible-Changed-From-To: freebsd-bugs->kientzle 
Responsible-Changed-By: kientzle 
Responsible-Changed-When: Sun Apr 4 11:45:00 PDT 2004 
Responsible-Changed-Why:  
Not a bug. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=47560 
>Unformatted:
