{"thread":{"id":"30801","subject":"Checksum incorrectly uses signed values","startedAt":"2012-06-14T01:16:21Z","lastAt":"2012-06-14T14:50:30Z","messageCount":3,"participants":["Brendan Brewster","Tomas Carnecky"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"193610","messageId":"CA+-ctj5M4XraOQJfWRVVFmRrNsUZUJyt63_Oi__OJCcYMC=ciw@mail.gmail.com","threadId":"30801","inReplyTo":null,"subject":"Checksum incorrectly uses signed values","fromName":"Brendan Brewster","fromEmail":"brendan.brewster@gmail.com","sentAt":"2012-06-14T01:16:21Z","receivedAt":"2012-06-14T01:16:21Z","isPatch":false,"sender":{"key":"brendan.brewster@gmail.com","avatar":null},"body":"Hi,\n\nI initially reported this issue to another developer thinking the\nissue resided there but after some testing and discussion, have found\nthat the issue is not there but possibly here :)\n\nThe issue, in summary, is that 7-zip was unable to untar a tar created\nvia a \"git archive\" whereas gnu tar can. It seem that it may be the\ncase that git is incorrectly using signed values when creating the\nchecksum.\n\nAs Igor commented in the other aforementioned thread, \"[t]hey use\n'char' (that is 'signed char' by default in most compilers). BUT\ncorrect TAR must use sum of unsigned values.\"\n\nPlease see the following:\n\n1) The thread previously opened with Igor/7-Zip:\nhttp://sourceforge.net/projects/sevenzip/forums/forum/45798/topic/5322604\n2) http://www.gnu.org/software/tar/manual/html_node/Checksumming.html\n3) TAR source code:\n     tar_checksum\n      and\n     simple_finish_header\n      functions.\n4) GIT source code that calculates checksum: ustar_header_chksum\nfunction in archive-tar.c. For reference, here is the snippet of the\ngit source code in question:\n\ngit-git-f623ca1\\archive-tar.c\nstatic unsigned int ustar_header_chksum(const struct ustar_header *header)\n{\n       const char *p = (const char *)header;\n       unsigned int chksum = 0;\n       while (p < header->chksum)\n               chksum += *p++;\n       chksum += sizeof(header->chksum) * ' ';\n       p += sizeof(header->chksum);\n       while (p < (const char *)header + sizeof(struct ustar_header))\n               chksum += *p++;\n       return chksum;\n}\n\nCan someone please look into this and possibly redirect if needed?\n\nThanks,\nBrendan\n"},{"id":"193613","messageId":"1339648521-ner-3801@calvin","threadId":"30801","inReplyTo":"CA+-ctj5M4XraOQJfWRVVFmRrNsUZUJyt63_Oi__OJCcYMC=ciw@mail.gmail.com","subject":"Re: Checksum incorrectly uses signed values","fromName":"Tomas Carnecky","fromEmail":"tomas.carnecky@gmail.com","sentAt":"2012-06-14T04:35:21Z","receivedAt":"2012-06-14T04:35:21Z","isPatch":false,"sender":{"key":"tomas.carnecky@gmail.com","avatar":null},"body":"On Wed, 13 Jun 2012 21:16:21 -0400, Brendan Brewster <brendan.brewster@gmail.com> wrote:\n> Hi,\n> \n> The issue, in summary, is that 7-zip was unable to untar a tar created\n> via a \"git archive\" whereas gnu tar can. It seem that it may be the\n> case that git is incorrectly using signed values when creating the\n> checksum.\n> \n> Can someone please look into this and possibly redirect if needed?\n\nThat was reported a day ago and Junio already wrote a patch. See\nhttp://article.gmane.org/gmane.comp.version-control.git/199911.\n\ntom\n"},{"id":"193655","messageId":"CA+-ctj5tXQmeHcZ5CC74O5QSyOH1sEYTSL-f3Rcc4MtqmGnTgA@mail.gmail.com","threadId":"30801","inReplyTo":"CA+-ctj7v2v+=Sa2A+wSieXp26Q4wgVrTJnwyCt_erfPBmpdcdA@mail.gmail.com","subject":"Re: Checksum incorrectly uses signed values","fromName":"Brendan Brewster","fromEmail":"brendan.brewster@gmail.com","sentAt":"2012-06-14T14:50:30Z","receivedAt":"2012-06-14T14:50:30Z","isPatch":false,"sender":{"key":"brendan.brewster@gmail.com","avatar":null},"body":"On Thu, Jun 14, 2012 at 12:39 AM, Brendan Brewster\n<brendan.brewster@gmail.com> wrote:\n> Hi Tomas/Junio,\n>\n> Yes, that is definitely it. The referenced 7-zip thread was my own\n> that I tried to report today; I guess that's what I get for going on\n> vacation and not getting a chance to submit my report here until after\n> getting back :)\n>\n> Thanks, this is good news. I will report back to Igor on this.\n>\n> Thanks again,\n> Brendan\n>\n> On Thu, Jun 14, 2012 at 12:35 AM, Tomas Carnecky\n> <tomas.carnecky@gmail.com> wrote:\n>> On Wed, 13 Jun 2012 21:16:21 -0400, Brendan Brewster <brendan.brewster@gmail.com> wrote:\n>>> Hi,\n>>>\n>>> The issue, in summary, is that 7-zip was unable to untar a tar created\n>>> via a \"git archive\" whereas gnu tar can. It seem that it may be the\n>>> case that git is incorrectly using signed values when creating the\n>>> checksum.\n>>>\n>>> Can someone please look into this and possibly redirect if needed?\n>>\n>> That was reported a day ago and Junio already wrote a patch. See\n>> http://article.gmane.org/gmane.comp.version-control.git/199911.\n>>\n>> tom\n\nPushing this to the mailing list (sorry for the top post initially).\n\n-Brendan\n"}]}