git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "René Scharfe" <rene.scharfe@lsrfire.ath.cx>
To: Jeff King <peff@peff.net>
Cc: BJ Hargrave <bj@bjhargrave.com>, git@vger.kernel.org
Subject: Re: tar on Mac does not like empty tar from git archive
Date: Tue, 09 Apr 2013 21:37:54 +0200	[thread overview]
Message-ID: <51646E12.2030506@lsrfire.ath.cx> (raw)
In-Reply-To: <20130408210536.GB9649@sigill.intra.peff.net>

Am 08.04.2013 23:05, schrieb Jeff King:
> On Mon, Apr 08, 2013 at 02:36:05PM -0400, BJ Hargrave wrote:
> 
>> Git 1.8.2.1 includes commit bd54cf17 - archive: handle commits with an
>> empty tree
>>
>> Test 2 of t5004-archive-corner-cases, "tar archive of empty tree is
>> empty", fails on Mac OS X 10.8.3 (with XCode 4.6.1) since the tar
>> command exits with return code 1 on the generated  tar file.
> 
> Hmm. So I guess the question is: do we need to work around this in the
> test for platforms that do not like empty tar files, or are the empty
> tarfiles we are making wrong somehow?
> 
>> tar --version
>> bsdtar 2.8.3 - libarchive 2.8.3
>>
>> It appears that bsdtar does not like the empty tar files created by
>> git archive. An empty tar file created by bsdtar is accepted.
>>
>> tar cT /dev/null | tar t; echo $?
>> 0
> 
> That makes me think the latter ("we are wrong"). I don't have my OS X
> box handy; can you provide a sample empty tarfile that it creates?

libarchive (on which bsdtar is based) doesn't like extended pax headers
at the end of archives.  Here's the relevant source file:

https://github.com/libarchive/libarchive/blob/master/libarchive/archive_read_support_format_tar.c

tar_read_header() calls header_pax_global() to handle a global pax
header, which in turn calls tar_read_header() again to fetch the next
header.  If it reaches the end of the archive then err is set to
ARCHIVE_EOF and "Damaged tar archive" is reported at the end of this
function.

I tried come up with a small patch that convinces it to ignore such a
condition, but it's apparently not as easy as it looks -- I just made
bsdtar report even more obscure errors.  Will look deeper into it
later this week.

René

  parent reply	other threads:[~2013-04-09 19:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-08 18:36 tar on Mac does not like empty tar from git archive BJ Hargrave
2013-04-08 21:05 ` Jeff King
2013-04-08 22:07   ` BJ Hargrave
2013-04-09 19:37   ` René Scharfe [this message]
2013-04-10 17:00 ` René Scharfe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51646E12.2030506@lsrfire.ath.cx \
    --to=rene.scharfe@lsrfire.ath.cx \
    --cc=bj@bjhargrave.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).