{"thread":{"id":"19902","subject":"git-mailsplit and TortoiseGit bugs","startedAt":"2009-06-22T17:53:51Z","lastAt":"2009-06-23T08:13:42Z","messageCount":7,"participants":["Filip Navara","Jeff King","Frank Li","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"116778","messageId":"5b31733c0906221053k4b2659bev1da861b8e997eb5f@mail.gmail.com","threadId":"19902","inReplyTo":null,"subject":"git-mailsplit and TortoiseGit bugs","fromName":"Filip Navara","fromEmail":"filip.navara@gmail.com","sentAt":"2009-06-22T17:53:51Z","receivedAt":"2009-06-22T17:53:51Z","isPatch":false,"sender":{"key":"filip.navara@gmail.com","avatar":null},"body":"Hello,\n\nI'd like to report a bug. There's an incompatibility between the way\nTortoiseGit sends patches by e-mail and their handling by\ngit-mailsplit. The mail sent by TortoiseGit specifies the Content-Type\nheader as \"Content-Type: text/plain;\nboundary=WC_MAIL_PaRt_BoUnDaRy_05151998\". git-mailsplit then\nmisinterprets it and treats it as empty patch. While TortoiseGit\nshould not be sending the boundary parameter, it is perfectly valid\ne-mail according to RFC 5322 and MIME RFCs. The \"boundary\" parameter\nshould be ignored for anything but \"multipart\" Content-Types.\n\nBest regards,\nFilip Navara\n\nP.S. I'm not subscribed to the mailing lists, so please CC me if you reply.\n"},{"id":"116786","messageId":"20090622202939.GA11912@sigill.intra.peff.net","threadId":"19902","inReplyTo":"5b31733c0906221053k4b2659bev1da861b8e997eb5f@mail.gmail.com","subject":"Re: git-mailsplit and TortoiseGit bugs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-06-22T20:29:40Z","receivedAt":"2009-06-22T20:29:40Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 22, 2009 at 07:53:51PM +0200, Filip Navara wrote:\n\n> I'd like to report a bug. There's an incompatibility between the way\n> TortoiseGit sends patches by e-mail and their handling by\n> git-mailsplit. The mail sent by TortoiseGit specifies the Content-Type\n> header as \"Content-Type: text/plain;\n> boundary=WC_MAIL_PaRt_BoUnDaRy_05151998\". git-mailsplit then\n> misinterprets it and treats it as empty patch. While TortoiseGit\n> should not be sending the boundary parameter, it is perfectly valid\n> e-mail according to RFC 5322 and MIME RFCs. The \"boundary\" parameter\n> should be ignored for anything but \"multipart\" Content-Types.\n\nThat seems like a bug in TortoiseGit, and I don't know if it is worth\ngit trying to work around problems in something that is not even close\nto a 1.0 version.\n\nStill, it is good to be liberal in what we accept. So maybe the patch\nbelow is worth applying (I assume from your description it will fix the\nproblem you are having, but I didn't actually test it with TortoiseGit;\nplease confirm that it helps).\n\n-- >8 --\nmailinfo: accept useless non-multipart boundary attributes\n\nThere is no reason for a program generating a patch email to\nadd a \"boundary\" parameter to a text/plain (or any other\nnon-multipart) content type. However, at least one version\nof TortoiseGit does so, confusing git-mailinfo, which looks\nfor and fails to find the boundary.\n\nThis patch causes mailinfo to respect boundary parameters\nonly for multipart/* content types, and simply ignore the\nparameter otherwise.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin-mailinfo.c            |    3 ++-\n t/t5100-mailinfo.sh           |   13 +++++++++++++\n t/t5100/boundary.in           |   20 ++++++++++++++++++++\n t/t5100/boundary.msg.expect   |    2 ++\n t/t5100/boundary.out.expect   |    5 +++++\n t/t5100/boundary.patch.expect |   11 +++++++++++\n 6 files changed, 53 insertions(+), 1 deletions(-)\n create mode 100644 t/t5100/boundary.in\n create mode 100644 t/t5100/boundary.msg.expect\n create mode 100644 t/t5100/boundary.out.expect\n create mode 100644 t/t5100/boundary.patch.expect\n\ndiff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\nindex 92637ac..3e9dbe0 100644\n--- a/builtin-mailinfo.c\n+++ b/builtin-mailinfo.c\n@@ -184,7 +184,8 @@ static void handle_content_type(struct strbuf *line)\n \n \tif (!strcasestr(line->buf, \"text/\"))\n \t\t message_type = TYPE_OTHER;\n-\tif (slurp_attr(line->buf, \"boundary=\", boundary)) {\n+\tif (strcasestr(line->buf, \"multipart/\") &&\n+\t    slurp_attr(line->buf, \"boundary=\", boundary)) {\n \t\tstrbuf_insert(boundary, 0, \"--\", 2);\n \t\tif (++content_top > &content[MAX_BOUNDARIES]) {\n \t\t\tfprintf(stderr, \"Too many boundaries to handle\\n\");\ndiff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh\nindex e70ea94..e67ce55 100755\n--- a/t/t5100-mailinfo.sh\n+++ b/t/t5100-mailinfo.sh\n@@ -77,4 +77,17 @@ test_expect_success 'mailinfo on from header without name works' '\n \n '\n \n+test_expect_success 'mailinfo on text message with useless boundary' '\n+\n+\tmkdir boundary &&\n+\tgit mailsplit -oboundary \"$TEST_DIRECTORY\"/t5100/boundary.in &&\n+\ttest_cmp \"$TEST_DIRECTORY\"/t5100/boundary.in boundary/0001 &&\n+\tgit mailinfo boundary/msg boundary/patch \\\n+\t  <boundary/0001 >boundary/out &&\n+\ttest_cmp \"$TEST_DIRECTORY\"/t5100/boundary.out.expect boundary/out &&\n+\ttest_cmp \"$TEST_DIRECTORY\"/t5100/boundary.msg.expect boundary/msg &&\n+\ttest_cmp \"$TEST_DIRECTORY\"/t5100/boundary.patch.expect boundary/patch\n+\n+'\n+\n test_done\ndiff --git a/t/t5100/boundary.in b/t/t5100/boundary.in\nnew file mode 100644\nindex 0000000..367ed7d\n--- /dev/null\n+++ b/t/t5100/boundary.in\n@@ -0,0 +1,20 @@\n+From nobody Mon Sep 17 00:00:00 2001\n+From: A U Thor <a.u.thor@example.com>\n+Date: Fri, 9 Jun 2006 00:44:16 -0700\n+Subject: [PATCH] a commit\n+MIME-Version: 1.0\n+Content-Type: text/plain; boundary=\"totally_useless\"\n+\n+Commit message.\n+\n+---\n+ foo |    2 +-\n+ 1 files changed, 1 insertions(+), 1 deletions(-)\n+\n+diff --git a/foo b/foo\n+index 9123cdc..918dcf8 100644\n+--- a/foo\n++++ b/foo\n+@@ -1 +1 @@\n+-Fri Jun  9 00:44:04 PDT 2006\n++Fri Jun  9 00:44:13 PDT 2006\ndiff --git a/t/t5100/boundary.msg.expect b/t/t5100/boundary.msg.expect\nnew file mode 100644\nindex 0000000..550aef5\n--- /dev/null\n+++ b/t/t5100/boundary.msg.expect\n@@ -0,0 +1,2 @@\n+Commit message.\n+\ndiff --git a/t/t5100/boundary.out.expect b/t/t5100/boundary.out.expect\nnew file mode 100644\nindex 0000000..f247b6f\n--- /dev/null\n+++ b/t/t5100/boundary.out.expect\n@@ -0,0 +1,5 @@\n+Author: A U Thor\n+Email: a.u.thor@example.com\n+Subject: a commit\n+Date: Fri, 9 Jun 2006 00:44:16 -0700\n+\ndiff --git a/t/t5100/boundary.patch.expect b/t/t5100/boundary.patch.expect\nnew file mode 100644\nindex 0000000..bd32624\n--- /dev/null\n+++ b/t/t5100/boundary.patch.expect\n@@ -0,0 +1,11 @@\n+---\n+ foo |    2 +-\n+ 1 files changed, 1 insertions(+), 1 deletions(-)\n+\n+diff --git a/foo b/foo\n+index 9123cdc..918dcf8 100644\n+--- a/foo\n++++ b/foo\n+@@ -1 +1 @@\n+-Fri Jun  9 00:44:04 PDT 2006\n++Fri Jun  9 00:44:13 PDT 2006\n-- \n1.6.3.2.406.gd6a466.dirty\n"},{"id":"116791","messageId":"5b31733c0906221446m1a82b39fkd5d25ea413697138@mail.gmail.com","threadId":"19902","inReplyTo":"20090622202939.GA11912@sigill.intra.peff.net","subject":"Re: git-mailsplit and TortoiseGit bugs","fromName":"Filip Navara","fromEmail":"filip.navara@gmail.com","sentAt":"2009-06-22T21:46:35Z","receivedAt":"2009-06-22T21:46:35Z","isPatch":false,"sender":{"key":"filip.navara@gmail.com","avatar":null},"body":"On Mon, Jun 22, 2009 at 10:29 PM, Jeff King<peff@peff.net> wrote:\n> On Mon, Jun 22, 2009 at 07:53:51PM +0200, Filip Navara wrote:\n>\n>> I'd like to report a bug. There's an incompatibility between the way\n>> TortoiseGit sends patches by e-mail and their handling by\n>> git-mailsplit. The mail sent by TortoiseGit specifies the Content-Type\n>> header as \"Content-Type: text/plain;\n>> boundary=WC_MAIL_PaRt_BoUnDaRy_05151998\". git-mailsplit then\n>> misinterprets it and treats it as empty patch. While TortoiseGit\n>> should not be sending the boundary parameter, it is perfectly valid\n>> e-mail according to RFC 5322 and MIME RFCs. The \"boundary\" parameter\n>> should be ignored for anything but \"multipart\" Content-Types.\n>\n> That seems like a bug in TortoiseGit, and I don't know if it is worth\n> git trying to work around problems in something that is not even close\n> to a 1.0 version.\n>\n> Still, it is good to be liberal in what we accept. So maybe the patch\n> below is worth applying (I assume from your description it will fix the\n> problem you are having, but I didn't actually test it with TortoiseGit;\n> please confirm that it helps).\n\nYes, this patch helps. While TortoiseGit shouldn't send the parameter\nin the first place it's still prefectly valid e-mail that should be\naccepted. Of course I will report it in the TortoiseGit issue tracker\nfor fixing.\n\nThanks,\nFilip Navara\n"},{"id":"116798","messageId":"1976ea660906221826lfc074c2x6231dcae16535a9c@mail.gmail.com","threadId":"19902","inReplyTo":"5b31733c0906221446m1a82b39fkd5d25ea413697138@mail.gmail.com","subject":"Re: git-mailsplit and TortoiseGit bugs","fromName":"Frank Li","fromEmail":"lznuaa@gmail.com","sentAt":"2009-06-23T01:26:51Z","receivedAt":"2009-06-23T01:26:51Z","isPatch":false,"sender":{"key":"lznuaa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40642?v=4"},"body":"Do you means I should remove \"boundary=WC_MAIL_PaRt_BoUnDaRy_05151998\"\nwhen send patch without attachment?\n\nTortoisegit bug report:\nhttp://code.google.com/p/tortoisegit/issues/list\n\nbest regards\nFrank Li\n\n2009/6/23 Filip Navara <filip.navara@gmail.com>:\n> On Mon, Jun 22, 2009 at 10:29 PM, Jeff King<peff@peff.net> wrote:\n>> On Mon, Jun 22, 2009 at 07:53:51PM +0200, Filip Navara wrote:\n>>\n>>> I'd like to report a bug. There's an incompatibility between the way\n>>> TortoiseGit sends patches by e-mail and their handling by\n>>> git-mailsplit. The mail sent by TortoiseGit specifies the Content-Type\n>>> header as \"Content-Type: text/plain;\n>>> boundary=WC_MAIL_PaRt_BoUnDaRy_05151998\". git-mailsplit then\n>>> misinterprets it and treats it as empty patch. While TortoiseGit\n>>> should not be sending the boundary parameter, it is perfectly valid\n>>> e-mail according to RFC 5322 and MIME RFCs. The \"boundary\" parameter\n>>> should be ignored for anything but \"multipart\" Content-Types.\n>>\n>> That seems like a bug in TortoiseGit, and I don't know if it is worth\n>> git trying to work around problems in something that is not even close\n>> to a 1.0 version.\n>>\n>> Still, it is good to be liberal in what we accept. So maybe the patch\n>> below is worth applying (I assume from your description it will fix the\n>> problem you are having, but I didn't actually test it with TortoiseGit;\n>> please confirm that it helps).\n>\n> Yes, this patch helps. While TortoiseGit shouldn't send the parameter\n> in the first place it's still prefectly valid e-mail that should be\n> accepted. Of course I will report it in the TortoiseGit issue tracker\n> for fixing.\n>\n> Thanks,\n> Filip Navara\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n"},{"id":"116799","messageId":"7vskhra7el.fsf@alter.siamese.dyndns.org","threadId":"19902","inReplyTo":"20090622202939.GA11912@sigill.intra.peff.net","subject":"Re: git-mailsplit and TortoiseGit bugs","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-06-23T04:41:38Z","receivedAt":"2009-06-23T04:41:38Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> mailinfo: accept useless non-multipart boundary attributes\n\nIs this \"accept\"? Or do you mean \"ignore\"?\n"},{"id":"116800","messageId":"20090623044258.GA26875@coredump.intra.peff.net","threadId":"19902","inReplyTo":"7vskhra7el.fsf@alter.siamese.dyndns.org","subject":"Re: git-mailsplit and TortoiseGit bugs","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-06-23T04:42:58Z","receivedAt":"2009-06-23T04:42:58Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Mon, Jun 22, 2009 at 09:41:38PM -0700, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > mailinfo: accept useless non-multipart boundary attributes\n> \n> Is this \"accept\"? Or do you mean \"ignore\"?\n\nSaying \"ignore\" is probably more accurate.\n\n-Peff\n"},{"id":"116808","messageId":"5b31733c0906230113u518cbd96t4ab825d83eafbe8a@mail.gmail.com","threadId":"19902","inReplyTo":"1976ea660906221826lfc074c2x6231dcae16535a9c@mail.gmail.com","subject":"Re: git-mailsplit and TortoiseGit bugs","fromName":"Filip Navara","fromEmail":"filip.navara@gmail.com","sentAt":"2009-06-23T08:13:42Z","receivedAt":"2009-06-23T08:13:42Z","isPatch":false,"sender":{"key":"filip.navara@gmail.com","avatar":null},"body":"On Tue, Jun 23, 2009 at 3:26 AM, Frank Li<lznuaa@gmail.com> wrote:\n> Do you means I should remove \"boundary=WC_MAIL_PaRt_BoUnDaRy_05151998\"\n> when send patch without attachment?\n\nYes, it's meaningless for text/plain mails.\n\n>\n> Tortoisegit bug report:\n> http://code.google.com/p/tortoisegit/issues/list\n>\n> best regards\n> Frank Li\n\nBest regards,\nFilip Navara\n"}]}