git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git archive generates tar with malformed pax extended attribute

From
Keegan Carruthers-Smith <keegan.csmith@gmail.com>
Date
May 24, 2019, 07:35 UTC
Message-ID
<CAMVcy0ThtcDNjqat0+nQ4B91hC30NTUe=RW8v9WDxA2Q-4SyRA@mail.gmail.com>
In-Reply-To
<20190524070644.GF25694@sigill.intra.peff.net>
On Fri, 24 May 2019 at 09:06, Jeff King <peff@peff.net> wrote:
Show 24 quoted lines
>
> On Fri, May 24, 2019 at 08:45:23AM +0200, Keegan Carruthers-Smith wrote:
>
> > git archive can generate a malformed tar archive. bsdtar reports the
> > error "tar: Ignoring malformed pax extended attribute" when reading
> > the archive. Go's "tar/archive" package also reports the error
> > "archive/tar: invalid tar header". However, BusyBox's tar does not
> > report the error (unsure if it just has less error logging).
> >
> > I can reproduce this when generating the tar on linux and mac. I
> > tested this with "git version 2.21.0" and a build of next I did today:
> > "git version 2.22.0.rc1.257.g3120a18244"
> >
> > Reproduction:
> >
> >   $ git clone https://github.com/SSW-SCIENTIFIC/NNDD.git
> >   $ cd NNDD
> >   $ git archive --format tar c21b98da2ca7f007230e696b2eda5da6589fe137
> > | tar tf - > /dev/null
> >   tar: Ignoring malformed pax extended attribute
> >   tar: Error exit delayed from previous errors.
>
> I can't reproduce on Linux, using GNU tar (1.30) nor with bsdtar 3.3.3
> (from Debian's bsdtar package). What does your "tar --version" say?
bsdtar 2.8.3 - libarchive 2.8.3
Show 9 quoted lines
> Git does write a pax header with the commit id in it as a comment.
> Presumably that's what it's complaining about (but it is not malformed
> according to any tar I've tried). If you feed git-archive a tree rather
> than a commit, that is omitted. What does:
>
>   git archive --format tar c21b98da2^{tree} | tar tf - >/dev/null
>
> say? If it doesn't complain, then we know it's indeed the pax comment
> field.
It also complains
  $ git archive --format tar c21b98da2^{tree} | tar tf - >/dev/null
  tar: Ignoring malformed pax extended attribute
  tar: Error exit delayed from previous errors.

Some more context: I work at Sourcegraph.com We mirror a lot of repos from github.com. We usually interact with a working copy by running git archive on it in our infrastructure. This is the first repository that I have noticed which produces this error. An interesting thing to note is the commit metadata contains a lot of non-ascii text which was my guess at what my be tripping up the tar creation.

Keegan
Previous: Jeff KingNext: Jeff King
Message 3 of 21 in “git archive generates tar with malformed pax extended attribute”
  1. Keegan Carruthers-SmithMay 24, 2019
  2. Jeff KingMay 24, 2019
  3. Keegan Carruthers-SmithMay 24, 2019
  4. Jeff KingMay 24, 2019
  5. René ScharfeMay 25, 2019
  6. Andreas SchwabMay 25, 2019
  7. Ævar Arnfjörð BjarmasonMay 25, 2019
  8. René ScharfeMay 26, 2019
  9. Jeff KingMay 28, 2019
  10. Jeff KingMay 28, 2019
  11. René ScharfeMay 28, 2019
  12. Jeff KingMay 28, 2019
  13. René ScharfeMay 28, 2019
  14. Jeff KingMay 29, 2019
  15. René ScharfeMay 29, 2019
  16. Jeff KingMay 30, 2019
  17. René ScharfeJun 2, 2019
  18. Jeff KingJun 4, 2019
  19. Keegan Carruthers-SmithMay 27, 2019
  20. Ævar Arnfjörð BjarmasonMay 25, 2019
  21. brian m. carlsonMay 25, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.