From: Junio C Hamano <junkio@cox.net>
To: ebiederm@xmission.com (Eric W. Biederman)
Cc: git@vger.kernel.org
Subject: Re: [PATCH 5/6] More accurately detect header lines in read_one_header_line
Date: Fri, 26 May 2006 00:29:22 -0700 [thread overview]
Message-ID: <7vy7wpnt0t.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <m1mzd8iklr.fsf_-_@ebiederm.dsl.xmission.com> (Eric W. Biederman's message of "Tue, 23 May 2006 13:53:20 -0600")
ebiederm@xmission.com (Eric W. Biederman) writes:
> Only count lines of the form '^.*: ' and '^From ' as email
> header lines.
I am having trouble with this patch.
> diff --git a/mailinfo.c b/mailinfo.c
> index 99989c2..c642ff4 100644
> --- a/mailinfo.c
> +++ b/mailinfo.c
> @@ -385,20 +385,29 @@ static int read_one_header_line(char *li
> {
> int ofs = 0;
> while (ofs < sz) {
> + const char *colon;
> int peek, len;
> if (fgets(line + ofs, sz - ofs, in) == NULL)
> + break;
> len = eatspace(line + ofs);
> if (len == 0)
> + break;
> + colon = strchr(line, ':');
> + if (!colon || !isspace(colon[1])) {
> + /* Readd the newline */
> + line[ofs + len] = '\n';
> + line[ofs + len + 1] = '\0';
> + break;
> }
Because eatspace() eats the trailing space, although your commit
message say lines matching "^.*: " are headers, this does not
match the criteria:
X-Spam-Checker-Version: SpamAssassin 3.1.1 (2006-03-10) on
gitster.siamese.dyndns.org
-> X-Spam-Level:
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00
autolearn=ham version=3.1.1
Notice that the field body for this unstructured header
X-Spam-Level (an optional field) consists of a single
whitespace. It will be gone because of eatspace() when your
check sees the line, so the header parsing stops prematurely.
Was there a particular reason you needed this change? That is,
did you have to parse mail-looking input that does not have a
blank line between runs of headers and the body of the message?
If so, I'd at least like to remove the || !isspace(colon[1])
from the test. After all, I do not think RFC2822 requires a
whitespace after the colon there.
next prev parent reply other threads:[~2006-05-26 7:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-23 19:42 [PATCH 0/6] Detect non email patches in git-mailinfo Eric W. Biederman
2006-05-23 19:44 ` [PATCH 1/6] Make read_one_header_line return a flag not a length Eric W. Biederman
2006-05-23 19:45 ` [PATCH 2/6] Move B and Q decoding into check header Eric W. Biederman
2006-05-23 19:47 ` [PATCH 3/6] Refactor commit messge handling Eric W. Biederman
2006-05-23 19:49 ` [PATCH 4/6] In handle_body only read a line if we don't already have one Eric W. Biederman
2006-05-23 19:53 ` [PATCH 5/6] More accurately detect header lines in read_one_header_line Eric W. Biederman
2006-05-23 19:58 ` [PATCH 6/6] Allow in body headers beyond the in body header prefix Eric W. Biederman
2006-05-26 7:29 ` Junio C Hamano [this message]
[not found] ` <7vr72hns7h.fsf@assigned-by-dhcp.cox.net>
2006-05-26 8:16 ` [PATCH 5/6] More accurately detect header lines in read_one_header_line Eric W. Biederman
2006-05-23 23:44 ` [PATCH 0/6] Detect non email patches in git-mailinfo Junio C Hamano
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=7vy7wpnt0t.fsf@assigned-by-dhcp.cox.net \
--to=junkio@cox.net \
--cc=ebiederm@xmission.com \
--cc=git@vger.kernel.org \
/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).