On Fri, May 24 2019, Jeff King wrote: > 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? > > 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. Solaris tar also complains about this. I've seen that for ages, but never thought to report it, I figured it was well-known. When you "tar xf" an archive git-archive it complains: tar: pax_global_header: typeflag 'g' not recognized, converting to regular file It will then extract the "pax_global_header" as if it were a file at the root of the archive. That file will look like this: $ wc -c x/pax_global_header 52 x/pax_global_header $ cat x/pax_global_header 52 comment=$40_CHAR_SHA_1 Where $40_CHAR_SHA_1 is whatever commit this archive was produced from.