git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Jay Soffian" <jaysoffian@gmail.com>
Cc: "Junio C Hamano" <gitster@pobox.com>,
	git@vger.kernel.org,
	"Johannes Schindelin" <Johannes.Schindelin@gmx.de>
Subject: Re: [PATCH 1/3] mailinfo: ensure handle_filter gets only one line at a time
Date: Fri, 15 Feb 2008 22:17:52 -0800	[thread overview]
Message-ID: <7vmyq1e86n.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <76718490802151537r7658e109o3c981832ae32154d@mail.gmail.com> (Jay Soffian's message of "Fri, 15 Feb 2008 18:37:06 -0500")

"Jay Soffian" <jaysoffian@gmail.com> writes:

> On Feb 15, 2008 6:24 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> And it appears to be an obvious fix that should even go to
>> 'maint' where no new features will land.
>
> Yes.
>
>> Care to provide a test case for this one?
>
> I'll see what I can do. I'm not sure it makes a difference...

Of course it does; otherwise I wouldn't have asked.

Thanks for the fix.  The following will go to 'maint'.

-- >8 --
From: Jay Soffian <jaysoffian@gmail.com>
Date: Fri, 15 Feb 2008 16:53:36 -0500
Subject: mailinfo: feed only one line to handle_filter() for QP input

The function is intended to be fed one logical line at a time to
inspect, but a QP encoded raw input line can have more than one
lines, just like BASE64 encoded one.

Quoting LF as =0A may be unusual but RFC2045 allows it.

The issue was noticed and fixed by Jay Soffian.  JC added a test
to protect the fix from regressing later.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-mailinfo.c  |    1 +
 t/t5100-mailinfo.sh |    2 +-
 t/t5100/info0009    |    5 +++++
 t/t5100/msg0009     |    2 ++
 t/t5100/patch0009   |   13 +++++++++++++
 t/t5100/sample.mbox |   23 +++++++++++++++++++++++
 6 files changed, 45 insertions(+), 1 deletions(-)

diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c
index 2600847..11f154b 100644
--- a/builtin-mailinfo.c
+++ b/builtin-mailinfo.c
@@ -818,6 +818,7 @@ static void handle_body(void)
 
 		switch (transfer_encoding) {
 		case TE_BASE64:
+		case TE_QP:
 		{
 			char *op = line;
 
diff --git a/t/t5100-mailinfo.sh b/t/t5100-mailinfo.sh
index 9b1a745..d6c55c1 100755
--- a/t/t5100-mailinfo.sh
+++ b/t/t5100-mailinfo.sh
@@ -11,7 +11,7 @@ test_expect_success 'split sample box' \
 	'git mailsplit -o. ../t5100/sample.mbox >last &&
 	last=`cat last` &&
 	echo total is $last &&
-	test `cat last` = 8'
+	test `cat last` = 9'
 
 for mail in `echo 00*`
 do
diff --git a/t/t5100/info0009 b/t/t5100/info0009
new file mode 100644
index 0000000..2a66321
--- /dev/null
+++ b/t/t5100/info0009
@@ -0,0 +1,5 @@
+Author: F U Bar
+Email: f.u.bar@example.com
+Subject: updates
+Date: Mon, 17 Sep 2001 00:00:00 +0900
+
diff --git a/t/t5100/msg0009 b/t/t5100/msg0009
new file mode 100644
index 0000000..9ffe131
--- /dev/null
+++ b/t/t5100/msg0009
@@ -0,0 +1,2 @@
+This is to fix diff-format documentation.
+
diff --git a/t/t5100/patch0009 b/t/t5100/patch0009
new file mode 100644
index 0000000..304cd55
--- /dev/null
+++ b/t/t5100/patch0009
@@ -0,0 +1,13 @@
+diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
+index b426a14..97756ec 100644
+--- a/Documentation/diff-format.txt
++++ b/Documentation/diff-format.txt
+@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
+ environment variable 'GIT_DIFF_OPTS'.  For example, if you
+ prefer context diff:
+ 
+-      GIT_DIFF_OPTS=-c git-diff-index -p $(cat .git/HEAD)
++      GIT_DIFF_OPTS=-c git-diff-index -p HEAD
+ 
+ 
+ 2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the
diff --git a/t/t5100/sample.mbox b/t/t5100/sample.mbox
index 070c166..b9bd90d 100644
--- a/t/t5100/sample.mbox
+++ b/t/t5100/sample.mbox
@@ -407,3 +407,26 @@ Subject: [PATCH] another patch
 
 Hey you forgot the patch!
 
+From nobody Mon Sep 17 00:00:00 2001
+From: A U Thor <a.u.thor@example.com>
+Date: Mon, 17 Sep 2001 00:00:00 +0900
+Mime-Version: 1.0
+Content-Type: Text/Plain; charset=us-ascii
+Content-Transfer-Encoding: Quoted-Printable
+
+=0A=0AFrom: F U Bar <f.u.bar@example.com>
+Subject: [PATCH] updates=0A=0AThis is to fix diff-format documentation.
+
+diff --git a/Documentation/diff-format.txt b/Documentation/diff-format.txt
+index b426a14..97756ec 100644
+--- a/Documentation/diff-format.txt
++++ b/Documentation/diff-format.txt
+@@ -81,7 +81,7 @@ The "diff" formatting options can be customized via the
+ environment variable 'GIT_DIFF_OPTS'.  For example, if you
+ prefer context diff:
+=20
+-      GIT_DIFF_OPTS=3D-c git-diff-index -p $(cat .git/HEAD)
++      GIT_DIFF_OPTS=3D-c git-diff-index -p HEAD
+=20
+=20
+ 2. When the environment variable 'GIT_EXTERNAL_DIFF' is set, the

  reply	other threads:[~2008-02-16  6:19 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-15 21:53 [PATCH 1/3] mailinfo: ensure handle_filter gets only one line at a time Jay Soffian
2008-02-15 21:53 ` [PATCH 2/3] mailinfo: support rfc3676 (format=flowed) text/plain messages Jay Soffian
2008-02-15 21:53   ` [PATCH 3/3] test mailinfo rfc3676 support Jay Soffian
2008-02-15 23:24 ` [PATCH 1/3] mailinfo: ensure handle_filter gets only one line at a time Junio C Hamano
2008-02-15 23:37   ` Jay Soffian
2008-02-16  6:17     ` Junio C Hamano [this message]
2008-02-16  6:22       ` Junio C Hamano
2008-02-16  6:51       ` Jay Soffian

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=7vmyq1e86n.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jaysoffian@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).