From: Jonathan Nieder <jrnieder@gmail.com>
To: Matt Turner <mattst88@gmail.com>
Cc: git@vger.kernel.org,
David Oberhollenzer <david.oberhollenzer@sigma-star.at>,
Rene Scharfe <l.s.r@web.de>
Subject: Re: [PATCH] archive: Store checksum correctly
Date: Tue, 23 Jul 2019 18:04:45 -0700 [thread overview]
Message-ID: <20190724010445.GA164908@google.com> (raw)
In-Reply-To: <20190723025736.23036-1-mattst88@gmail.com>
(cc: René Scharfe, "git archive" expert)
Matt Turner wrote:
> tar2sqfs (part of https://github.com/topics/tar2sqfs) rejects tarballs
> made with git archive with the message
>
> invalid tar header checksum!
>
> tar2sqfs recomputes the tarball's checksum to verify it. Its checksum
> implementation agrees with GNU tar, which contains a comment that states
>
> Fill in the checksum field. It's formatted differently from the
> other fields: it has [6] digits, a null, then a space ...
>
> Correcting this allows tar2sqfs to correctly process the tarballs made
> by git archive.
>
> Signed-off-by: Matt Turner <mattst88@gmail.com>
> ---
> archive-tar.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Nice. Is this something that can be covered in tests as well? (See
t500* for existing "git archive" tests, and see test_lazy_prereq in case
you'd like the test to use an external tool like tar2sqfs that not all
users may have.)
Thanks,
Jonathan
(patch left unsnipped for reference)
> diff --git a/archive-tar.c b/archive-tar.c
> index 3e53aac1e6..f9a157bfd1 100644
> --- a/archive-tar.c
> +++ b/archive-tar.c
> @@ -215,7 +215,9 @@ static void prepare_header(struct archiver_args *args,
> memcpy(header->magic, "ustar", 6);
> memcpy(header->version, "00", 2);
>
> - xsnprintf(header->chksum, sizeof(header->chksum), "%07o", ustar_header_chksum(header));
> + xsnprintf(header->chksum, sizeof(header->chksum), "%06o", ustar_header_chksum(header));
> + header->chksum[6] = '\0';
> + header->chksum[7] = ' ';
> }
>
> static void write_extended_header(struct archiver_args *args,
prev parent reply other threads:[~2019-07-24 1:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-23 2:57 [PATCH] archive: Store checksum correctly Matt Turner
2019-07-23 16:49 ` Junio C Hamano
2019-07-23 19:31 ` Jeff King
2019-07-23 19:38 ` René Scharfe
2019-07-23 20:08 ` René Scharfe
2019-07-23 21:34 ` David Oberhollenzer
2019-07-23 21:21 ` Junio C Hamano
2019-07-24 1:04 ` Jonathan Nieder [this message]
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=20190724010445.GA164908@google.com \
--to=jrnieder@gmail.com \
--cc=david.oberhollenzer@sigma-star.at \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--cc=mattst88@gmail.com \
/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).