{"thread":{"id":"46899","subject":"Is git am supposed to decode MIME?","startedAt":"2017-10-04T08:44:41Z","lastAt":"2017-10-12T13:20:25Z","messageCount":4,"participants":["Florian Weimer","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"329667","messageId":"24940e12-3f72-1ef0-0983-58523d8dec51@redhat.com","threadId":"46899","inReplyTo":null,"subject":"Is git am supposed to decode MIME?","fromName":"Florian Weimer","fromEmail":"fweimer@redhat.com","sentAt":"2017-10-04T08:44:31Z","receivedAt":"2017-10-04T08:44:41Z","isPatch":false,"sender":{"key":"fweimer@redhat.com","avatar":null},"body":"The git am documentation talks about “mailboxes”.  I suppose these \ncontain messages in Internet Mail syntax.  Is git am supposed to decode \nMIME?\n\nI'm asking because I have a message whose body is encoded as \nquoted-printable, but git am does not parse the patch contained in it.\n\nIf git am is supposed to deal with this, I'll dig deeper and try to \nfigure out where things go wrong.\n\nThanks,\nFlorian\n"},{"id":"329672","messageId":"20171004092546.vnjddxqwvia5cfn6@sigill.intra.peff.net","threadId":"46899","inReplyTo":"24940e12-3f72-1ef0-0983-58523d8dec51@redhat.com","subject":"Re: Is git am supposed to decode MIME?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2017-10-04T09:25:46Z","receivedAt":"2017-10-04T09:25:53Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Oct 04, 2017 at 10:44:31AM +0200, Florian Weimer wrote:\n\n> The git am documentation talks about “mailboxes”.  I suppose these contain\n> messages in Internet Mail syntax.  Is git am supposed to decode MIME?\n> \n> I'm asking because I have a message whose body is encoded as\n> quoted-printable, but git am does not parse the patch contained in it.\n> \n> If git am is supposed to deal with this, I'll dig deeper and try to figure\n> out where things go wrong.\n\nYes, it should. I just double-checked with the toy patch patch below,\nand it correctly extracted the quoted-printable from the commit message\nand patch, as well as in the headers.\n\n-- >8 --\nFrom peff@peff.net Wed Oct  4 05:21:57 2017\nDate: Wed, 4 Oct 2017 05:21:55 -0400\nFrom: =?utf-8?Q?=C3=81ccented N=C3=A1me?= <peff@peff.net>\nTo: Jeff King <peff@peff.net>\nSubject: [PATCH] add 8bit content\nMIME-Version: 1.0\nContent-Type: text/plain; charset=utf-8\nContent-Disposition: inline\nContent-Transfer-Encoding: quoted-printable\n\nThis commit message also has s=C3=B3me 8-bit characters which\nwill need qp-encoding.\n\nSigned-off-by: =C3=81ccented N=C3=A1me <peff@peff.net>\n---\n file | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/file b/file\nindex d95f3ad..d39c7fc 100644\n--- a/file\n+++ b/file\n@@ -1 +1 @@\n-content\n+8-bit c=C3=B3ntent\n--=20\n2.14.2.1117.g65a3442612\n\n"},{"id":"329673","messageId":"xmqqzi979qbe.fsf@gitster.mtv.corp.google.com","threadId":"46899","inReplyTo":"24940e12-3f72-1ef0-0983-58523d8dec51@redhat.com","subject":"Re: Is git am supposed to decode MIME?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-10-04T10:10:13Z","receivedAt":"2017-10-04T10:10:33Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Florian Weimer <fweimer@redhat.com> writes:\n\n> The git am documentation talks about “mailboxes”.  I suppose these\n> contain messages in Internet Mail syntax.  Is git am supposed to\n> decode MIME?\n>\n> I'm asking because I have a message whose body is encoded as\n> quoted-printable, but git am does not parse the patch contained in it.\n>\n> If git am is supposed to deal with this, I'll dig deeper and try to\n> figure out where things go wrong.\n\nThe code to check should be in <mailinfo.c>.  As its comment says,\nthe code was not designed to be a full MIME parser--we just have a\ncode that (empirically) works in practice on messages produced when\na patch is attached to a message via popular MUAs, not written from\nthe MIME RFC spec.\n\nThanks for your interest in making the world a better place ;-)\nVery much appreciated.\n\n\n"},{"id":"330280","messageId":"39aebcbd-7820-eafe-3c44-b96b057d0059@redhat.com","threadId":"46899","inReplyTo":"20171004092546.vnjddxqwvia5cfn6@sigill.intra.peff.net","subject":"Re: Is git am supposed to decode MIME?","fromName":"Florian Weimer","fromEmail":"fweimer@redhat.com","sentAt":"2017-10-12T13:20:19Z","receivedAt":"2017-10-12T13:20:25Z","isPatch":false,"sender":{"key":"fweimer@redhat.com","avatar":null},"body":"On 10/04/2017 11:25 AM, Jeff King wrote:\n> On Wed, Oct 04, 2017 at 10:44:31AM +0200, Florian Weimer wrote:\n> \n>> The git am documentation talks about “mailboxes”.  I suppose these contain\n>> messages in Internet Mail syntax.  Is git am supposed to decode MIME?\n>>\n>> I'm asking because I have a message whose body is encoded as\n>> quoted-printable, but git am does not parse the patch contained in it.\n>>\n>> If git am is supposed to deal with this, I'll dig deeper and try to figure\n>> out where things go wrong.\n> \n> Yes, it should. I just double-checked with the toy patch patch below,\n> and it correctly extracted the quoted-printable from the commit message\n> and patch, as well as in the headers.\n\nIt took me a while, but I know think the message is simply corrupted. \nIt's encoded with quoted-printable, and that looks correct, but it ends \nwith:\n\n@@ -5137,11 +5114,13 @@ __libc_mallopt (int param_number, int value)\n    if (__malloc_initialized < 0)\n      ptmalloc_init ();\n    __libc_lock_lock (av->mutex);\n-  /* Ensure initialization/consolidation */\n-  malloc_consolidate (av);\n=20\n    LIBC_PROBE (memory_mallopt, 2, param_number, value);\n=20\n+  /* We must consolidate main arena before changing max_fast\n+     (see definition of set_max_fast).  */\n+  malloc_consolidate (av);\n+\n    switch (param_number)\n      {\n      case M_MXFAST:=\n\nThe “=” masks the final newline, and that doesn't decode into a valid \ndiff hunk.  The file being patched continues after that, so it's not \neven the “\\ No newline at end of file” case.\n\nSo in short, there is no Git bug here, and I just failed to interpret \nthe “git am” diagnostics correctly:\n\nApplying: Improve malloc initialization sequence\nerror: corrupt patch at line 342\nPatch failed at 0001 Improve malloc initialization sequence\nThe copy of the patch that failed is found in: .git/rebase-apply/patch\n\nLine 342 refers to the file in .git/rebase-apply/patch, not the original \ninput, and it took me a while to figure that out.\n\nThanks,\nFlorian\n"}]}