All of lore.kernel.org
 help / color / mirror / Atom feed
* git-mailsplit and TortoiseGit bugs
@ 2009-06-22 17:53 Filip Navara
  2009-06-22 20:29 ` Jeff King
  0 siblings, 1 reply; 7+ messages in thread
From: Filip Navara @ 2009-06-22 17:53 UTC (permalink / raw)
  To: git; +Cc: tortoisegit-dev

Hello,

I'd like to report a bug. There's an incompatibility between the way
TortoiseGit sends patches by e-mail and their handling by
git-mailsplit. The mail sent by TortoiseGit specifies the Content-Type
header as "Content-Type: text/plain;
boundary=WC_MAIL_PaRt_BoUnDaRy_05151998". git-mailsplit then
misinterprets it and treats it as empty patch. While TortoiseGit
should not be sending the boundary parameter, it is perfectly valid
e-mail according to RFC 5322 and MIME RFCs. The "boundary" parameter
should be ignored for anything but "multipart" Content-Types.

Best regards,
Filip Navara

P.S. I'm not subscribed to the mailing lists, so please CC me if you reply.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-mailsplit and TortoiseGit bugs
  2009-06-22 17:53 git-mailsplit and TortoiseGit bugs Filip Navara
@ 2009-06-22 20:29 ` Jeff King
  2009-06-22 21:46   ` Filip Navara
  2009-06-23  4:41   ` Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Jeff King @ 2009-06-22 20:29 UTC (permalink / raw)
  To: Filip Navara; +Cc: Junio C Hamano, git, tortoisegit-dev

On Mon, Jun 22, 2009 at 07:53:51PM +0200, Filip Navara wrote:

> I'd like to report a bug. There's an incompatibility between the way
> TortoiseGit sends patches by e-mail and their handling by
> git-mailsplit. The mail sent by TortoiseGit specifies the Content-Type
> header as "Content-Type: text/plain;
> boundary=WC_MAIL_PaRt_BoUnDaRy_05151998". git-mailsplit then
> misinterprets it and treats it as empty patch. While TortoiseGit
> should not be sending the boundary parameter, it is perfectly valid
> e-mail according to RFC 5322 and MIME RFCs. The "boundary" parameter
> should be ignored for anything but "multipart" Content-Types.

That seems like a bug in TortoiseGit, and I don't know if it is worth
git trying to work around problems in something that is not even close
to a 1.0 version.

Still, it is good to be liberal in what we accept. So maybe the patch
below is worth applying (I assume from your description it will fix the
problem you are having, but I didn't actually test it with TortoiseGit;
please confirm that it helps).

-- >8 --
mailinfo: accept useless non-multipart boundary attributes

There is no reason for a program generating a patch email to
add a "boundary" parameter to a text/plain (or any other
non-multipart) content type. However, at least one version
of TortoiseGit does so, confusing git-mailinfo, which looks
for and fails to find the boundary.

This patch causes mailinfo to respect boundary parameters
only for multipart/* content types, and simply ignore the
parameter otherwise.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin-mailinfo.c            |    3 ++-
 t/t5100-mailinfo.sh           |   13 +++++++++++++
 t/t5100/boundary.in           |   20 ++++++++++++++++++++
 t/t5100/boundary.msg.expect   |    2 ++
 t/t5100/boundary.out.expect   |    5 +++++
 t/t5100/boundary.patch.expect |   11 +++++++++++
 6 files changed, 53 insertions(+), 1 deletions(-)
 create mode 100644 t/t5100/boundary.in
 create mode 100644 t/t5100/boundary.msg.expect
 create mode 100644 t/t5100/boundary.out.expect
 create mode 100644 t/t5100/boundary.patch.expect

diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 92637ac..3e9dbe0 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -184,7 +184,8 @@ static void handle_content_type(struct strbuf *line)
 
 	if (!strcasestr(line->buf, "text/"))
 		 message_type = TYPE_OTHER;
-	if (slurp_attr(line->buf, "boundary=", boundary)) {
+	if (strcasestr(line->buf, "multipart/") &&
+	    slurp_attr(line->buf, "boundary=", boundary)) {
 		strbuf_insert(boundary, 0, "--", 2);
 		if (++content_top > &content[MAX_BOUNDARIES]) {
 			fprintf(stderr, "Too many boundaries to handle\n");
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index e70ea94..e67ce55 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -77,4 +77,17 @@ test_expect_success 'mailinfo on from header without name works' '
 
 '
 
+test_expect_success 'mailinfo on text message with useless boundary' '
+
+	mkdir boundary &&
+	git mailsplit -oboundary "$TEST_DIRECTORY"/t5100/boundary.in &&
+	test_cmp "$TEST_DIRECTORY"/t5100/boundary.in boundary/0001 &&
+	git mailinfo boundary/msg boundary/patch \
+	  <boundary/0001 >boundary/out &&
+	test_cmp "$TEST_DIRECTORY"/t5100/boundary.out.expect boundary/out &&
+	test_cmp "$TEST_DIRECTORY"/t5100/boundary.msg.expect boundary/msg &&
+	test_cmp "$TEST_DIRECTORY"/t5100/boundary.patch.expect boundary/patch
+
+'
+
 test_done
diff --git a/t/t5100/boundary.in b/t/t5100/boundary.in
new file mode 100644
index 0000000..367ed7d
--- /dev/null
+++ b/t/t5100/boundary.in
@@ -0,0 +1,20 @@
+From nobody Mon Sep 17 00:00:00 2001
+From: A U Thor <a.u.thor@example.com>
+Date: Fri, 9 Jun 2006 00:44:16 -0700
+Subject: [PATCH] a commit
+MIME-Version: 1.0
+Content-Type: text/plain; boundary="totally_useless"
+
+Commit message.
+
+---
+ foo |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/foo b/foo
+index 9123cdc..918dcf8 100644
+--- a/foo
++++ b/foo
+@@ -1 +1 @@
+-Fri Jun  9 00:44:04 PDT 2006
++Fri Jun  9 00:44:13 PDT 2006
diff --git a/t/t5100/boundary.msg.expect b/t/t5100/boundary.msg.expect
new file mode 100644
index 0000000..550aef5
--- /dev/null
+++ b/t/t5100/boundary.msg.expect
@@ -0,0 +1,2 @@
+Commit message.
+
diff --git a/t/t5100/boundary.out.expect b/t/t5100/boundary.out.expect
new file mode 100644
index 0000000..f247b6f
--- /dev/null
+++ b/t/t5100/boundary.out.expect
@@ -0,0 +1,5 @@
+Author: A U Thor
+Email: a.u.thor@example.com
+Subject: a commit
+Date: Fri, 9 Jun 2006 00:44:16 -0700
+
diff --git a/t/t5100/boundary.patch.expect b/t/t5100/boundary.patch.expect
new file mode 100644
index 0000000..bd32624
--- /dev/null
+++ b/t/t5100/boundary.patch.expect
@@ -0,0 +1,11 @@
+---
+ foo |    2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/foo b/foo
+index 9123cdc..918dcf8 100644
+--- a/foo
++++ b/foo
+@@ -1 +1 @@
+-Fri Jun  9 00:44:04 PDT 2006
++Fri Jun  9 00:44:13 PDT 2006
-- 
1.6.3.2.406.gd6a466.dirty

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: git-mailsplit and TortoiseGit bugs
  2009-06-22 20:29 ` Jeff King
@ 2009-06-22 21:46   ` Filip Navara
  2009-06-23  1:26     ` Frank Li
  2009-06-23  4:41   ` Junio C Hamano
  1 sibling, 1 reply; 7+ messages in thread
From: Filip Navara @ 2009-06-22 21:46 UTC (permalink / raw)
  To: Jeff King; +Cc: Junio C Hamano, git, tortoisegit-dev

On Mon, Jun 22, 2009 at 10:29 PM, Jeff King<peff@peff.net> wrote:
> On Mon, Jun 22, 2009 at 07:53:51PM +0200, Filip Navara wrote:
>
>> I'd like to report a bug. There's an incompatibility between the way
>> TortoiseGit sends patches by e-mail and their handling by
>> git-mailsplit. The mail sent by TortoiseGit specifies the Content-Type
>> header as "Content-Type: text/plain;
>> boundary=WC_MAIL_PaRt_BoUnDaRy_05151998". git-mailsplit then
>> misinterprets it and treats it as empty patch. While TortoiseGit
>> should not be sending the boundary parameter, it is perfectly valid
>> e-mail according to RFC 5322 and MIME RFCs. The "boundary" parameter
>> should be ignored for anything but "multipart" Content-Types.
>
> That seems like a bug in TortoiseGit, and I don't know if it is worth
> git trying to work around problems in something that is not even close
> to a 1.0 version.
>
> Still, it is good to be liberal in what we accept. So maybe the patch
> below is worth applying (I assume from your description it will fix the
> problem you are having, but I didn't actually test it with TortoiseGit;
> please confirm that it helps).

Yes, this patch helps. While TortoiseGit shouldn't send the parameter
in the first place it's still prefectly valid e-mail that should be
accepted. Of course I will report it in the TortoiseGit issue tracker
for fixing.

Thanks,
Filip Navara

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-mailsplit and TortoiseGit bugs
  2009-06-22 21:46   ` Filip Navara
@ 2009-06-23  1:26     ` Frank Li
  2009-06-23  8:13       ` Filip Navara
  0 siblings, 1 reply; 7+ messages in thread
From: Frank Li @ 2009-06-23  1:26 UTC (permalink / raw)
  To: Filip Navara; +Cc: Jeff King, Junio C Hamano, git, tortoisegit-dev

Do you means I should remove "boundary=WC_MAIL_PaRt_BoUnDaRy_05151998"
when send patch without attachment?

Tortoisegit bug report:
http://code.google.com/p/tortoisegit/issues/list

best regards
Frank Li

2009/6/23 Filip Navara <filip.navara@gmail.com>:
> On Mon, Jun 22, 2009 at 10:29 PM, Jeff King<peff@peff.net> wrote:
>> On Mon, Jun 22, 2009 at 07:53:51PM +0200, Filip Navara wrote:
>>
>>> I'd like to report a bug. There's an incompatibility between the way
>>> TortoiseGit sends patches by e-mail and their handling by
>>> git-mailsplit. The mail sent by TortoiseGit specifies the Content-Type
>>> header as "Content-Type: text/plain;
>>> boundary=WC_MAIL_PaRt_BoUnDaRy_05151998". git-mailsplit then
>>> misinterprets it and treats it as empty patch. While TortoiseGit
>>> should not be sending the boundary parameter, it is perfectly valid
>>> e-mail according to RFC 5322 and MIME RFCs. The "boundary" parameter
>>> should be ignored for anything but "multipart" Content-Types.
>>
>> That seems like a bug in TortoiseGit, and I don't know if it is worth
>> git trying to work around problems in something that is not even close
>> to a 1.0 version.
>>
>> Still, it is good to be liberal in what we accept. So maybe the patch
>> below is worth applying (I assume from your description it will fix the
>> problem you are having, but I didn't actually test it with TortoiseGit;
>> please confirm that it helps).
>
> Yes, this patch helps. While TortoiseGit shouldn't send the parameter
> in the first place it's still prefectly valid e-mail that should be
> accepted. Of course I will report it in the TortoiseGit issue tracker
> for fixing.
>
> Thanks,
> Filip Navara
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-mailsplit and TortoiseGit bugs
  2009-06-22 20:29 ` Jeff King
  2009-06-22 21:46   ` Filip Navara
@ 2009-06-23  4:41   ` Junio C Hamano
  2009-06-23  4:42     ` Jeff King
  1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2009-06-23  4:41 UTC (permalink / raw)
  To: Jeff King; +Cc: Filip Navara, git, tortoisegit-dev

Jeff King <peff@peff.net> writes:

> mailinfo: accept useless non-multipart boundary attributes

Is this "accept"? Or do you mean "ignore"?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-mailsplit and TortoiseGit bugs
  2009-06-23  4:41   ` Junio C Hamano
@ 2009-06-23  4:42     ` Jeff King
  0 siblings, 0 replies; 7+ messages in thread
From: Jeff King @ 2009-06-23  4:42 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Filip Navara, git, tortoisegit-dev

On Mon, Jun 22, 2009 at 09:41:38PM -0700, Junio C Hamano wrote:

> Jeff King <peff@peff.net> writes:
> 
> > mailinfo: accept useless non-multipart boundary attributes
> 
> Is this "accept"? Or do you mean "ignore"?

Saying "ignore" is probably more accurate.

-Peff

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: git-mailsplit and TortoiseGit bugs
  2009-06-23  1:26     ` Frank Li
@ 2009-06-23  8:13       ` Filip Navara
  0 siblings, 0 replies; 7+ messages in thread
From: Filip Navara @ 2009-06-23  8:13 UTC (permalink / raw)
  To: Frank Li; +Cc: Jeff King, Junio C Hamano, git, tortoisegit-dev

On Tue, Jun 23, 2009 at 3:26 AM, Frank Li<lznuaa@gmail.com> wrote:
> Do you means I should remove "boundary=WC_MAIL_PaRt_BoUnDaRy_05151998"
> when send patch without attachment?

Yes, it's meaningless for text/plain mails.

>
> Tortoisegit bug report:
> http://code.google.com/p/tortoisegit/issues/list
>
> best regards
> Frank Li

Best regards,
Filip Navara

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-06-23  8:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-22 17:53 git-mailsplit and TortoiseGit bugs Filip Navara
2009-06-22 20:29 ` Jeff King
2009-06-22 21:46   ` Filip Navara
2009-06-23  1:26     ` Frank Li
2009-06-23  8:13       ` Filip Navara
2009-06-23  4:41   ` Junio C Hamano
2009-06-23  4:42     ` Jeff King

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.