From swell.k@gmail.com  Sun Feb  1 09:08:13 2009
Return-Path: <swell.k@gmail.com>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F405A10656DC
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  1 Feb 2009 09:08:12 +0000 (UTC)
	(envelope-from swell.k@gmail.com)
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.153])
	by mx1.freebsd.org (Postfix) with ESMTP id 82E068FC17
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  1 Feb 2009 09:08:12 +0000 (UTC)
	(envelope-from swell.k@gmail.com)
Received: by fg-out-1718.google.com with SMTP id l26so298657fgb.35
        for <FreeBSD-gnats-submit@freebsd.org>; Sun, 01 Feb 2009 01:08:11 -0800 (PST)
Received: by 10.86.80.17 with SMTP id d17mr218165fgb.14.1233477824019;
        Sun, 01 Feb 2009 00:43:44 -0800 (PST)
Received: from localhost (78-106-78-214.broadband.corbina.ru [78.106.78.214])
        by mx.google.com with ESMTPS id 12sm1179517fgg.53.2009.02.01.00.43.42
        (version=TLSv1/SSLv3 cipher=RC4-MD5);
        Sun, 01 Feb 2009 00:43:42 -0800 (PST)
Message-Id: <86hc3efsxv.fsf@gmail.com>
Date: Sun, 01 Feb 2009 11:43:40 +0300
From: Anonymous <swell.k@gmail.com>
To: FreeBSD-gnats-submit@freebsd.org
Subject: tar adds extra nul bytes at the end of non-emty files in shar archives
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         131244
>Category:       bin
>Synopsis:       tar(1) adds extra nul chars at the end of non-empty files in shar archives
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kientzle
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 01 09:10:06 UTC 2009
>Closed-Date:    Sun Mar 29 01:06:27 UTC 2009
>Last-Modified:  Sun Mar 29 01:10:03 UTC 2009
>Originator:     
>Release:        FreeBSD 8.0-CURRENT amd64
>Organization:
>Environment:
System: FreeBSD luffy 8.0-CURRENT FreeBSD 8.0-CURRENT #0 r187947M: Sat Jan 31 12:03:24 UTC 2009 root@luffy:/usr/obj/usr/src/sys/PHOENIX amd64

>Description:
	
>How-To-Repeat:
        $ touch foo bar
	$ tar cf a.shar --format shar foo bar
	$ vis a.shar
	#!/bin/sh
	# This is a shell archive
	echo x foo
	test -e "foo" || :> "foo"
	echo x bar
	test -e "bar" || :> "bar"
	exit

	$ echo blah >bar
	$ tar cf a.shar --format shar foo bar
	$ vis a.shar
	#!/bin/sh
	# This is a shell archive
	echo x foo
	test -e "foo" || :> "foo"
	echo x bar
	sed 's/^X//' > bar << 'SHAR_END'
	Xblah
	X\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@
	[...]
	\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@\^@
	SHAR_END
	exit

>Fix:
        create tar archive first and convert it to shar one
        $ tar cf a.shar --format shar @a.tar
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->kientzle 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Sun Feb 1 13:00:31 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer.  Submitter sees this on -CURRENT, I can also 
recreate it on freefall (7.1-PRERELEASE) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131244 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131244: commit references a PR
Date: Sun,  8 Feb 2009 22:03:01 +0000 (UTC)

 Author: kientzle
 Date: Sun Feb  8 22:02:46 2009
 New Revision: 188343
 URL: http://svn.freebsd.org/changeset/base/188343
 
 Log:
   When copying file data to the archive, don't write more
   than was read.  This seems to have only affected the shar
   writer, since other formats proactively truncate output
   to the originally-advertised size.
   
   PR:		bin/131244
   MFC after:	7 days
 
 Modified:
   head/usr.bin/tar/write.c
 
 Modified: head/usr.bin/tar/write.c
 ==============================================================================
 --- head/usr.bin/tar/write.c	Sun Feb  8 22:01:20 2009	(r188342)
 +++ head/usr.bin/tar/write.c	Sun Feb  8 22:02:46 2009	(r188343)
 @@ -972,7 +972,7 @@ write_file_data(struct bsdtar *bsdtar, s
  		siginfo_printinfo(bsdtar, progress);
  
  		bytes_written = archive_write_data(a, bsdtar->buff,
 -		    FILEDATABUFLEN);
 +		    bytes_read);
  		if (bytes_written < 0) {
  			/* Write failed; this is bad */
  			bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a));
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: Anonymous <swell.k@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131244: tar(1) adds extra nul chars at the end of non-empty files in shar archives
Date: Mon, 09 Feb 2009 09:10:18 +0300

 Anonymous <swell.k@gmail.com> writes:
 
 > Just updated to r188316. The bug is gone. No more extra nul chars.
 
 That was actually r188375. Sorry, I forgot to boot from newly compiled kernel.
 
 > Tried on i386 8-current using the above patch from r188343 - same effect.
 >
 > Problem solved, thanks. PR can be closed.

From: Anonymous <swell.k@gmail.com>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131244: tar(1) adds extra nul chars at the end of non-empty files in shar archives
Date: Mon, 09 Feb 2009 08:59:52 +0300

 Just updated to r188316. The bug is gone. No more extra nul chars.
 Tried on i386 8-current using the above patch from r188343 - same effect.
 
 Problem solved, thanks. PR can be closed.
State-Changed-From-To: open->patched 
State-Changed-By: gavin 
State-Changed-When: Thu Mar 26 12:27:52 UTC 2009 
State-Changed-Why:  
Mark as patched, this is fixed in HEAD but doesn't appear to have been 
backported to 7.x yet. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131244 
State-Changed-From-To: patched->closed 
State-Changed-By: kientzle 
State-Changed-When: Sun Mar 29 01:04:42 UTC 2009 
State-Changed-Why:  
Merged into 7-STABLE with r190517 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131244 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/131244: commit references a PR
Date: Sun, 29 Mar 2009 01:04:23 +0000 (UTC)

 Author: kientzle
 Date: Sun Mar 29 01:04:13 2009
 New Revision: 190517
 URL: http://svn.freebsd.org/changeset/base/190517
 
 Log:
   Merge r188343 from -CURRENT:   Unbreak writing shar archives.
      When copying file data to the archive, don't write more
      than was read.  This seems to have only affected the shar
      writer, since other formats proactively truncate output
      to the originally-advertised size.
   
   PR:		bin/131244
   Approved by:	re (Ken Smith)
 
 Modified:
   stable/7/usr.bin/tar/   (props changed)
   stable/7/usr.bin/tar/write.c
 
 Modified: stable/7/usr.bin/tar/write.c
 ==============================================================================
 --- stable/7/usr.bin/tar/write.c	Sun Mar 29 01:00:48 2009	(r190516)
 +++ stable/7/usr.bin/tar/write.c	Sun Mar 29 01:04:13 2009	(r190517)
 @@ -966,7 +966,7 @@ write_file_data(struct bsdtar *bsdtar, s
  		siginfo_printinfo(bsdtar, progress);
  
  		bytes_written = archive_write_data(a, bsdtar->buff,
 -		    FILEDATABUFLEN);
 +		    bytes_read);
  		if (bytes_written < 0) {
  			/* Write failed; this is bad */
  			bsdtar_warnc(bsdtar, 0, "%s", archive_error_string(a));
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
