git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: git-applymbox broken?

From
Eric W. Biederman <ebiederm@xmission.com>
Date
Jun 12, 2006, 07:35 UTC
Message-ID
<m1fyia967t.fsf@ebiederm.dsl.xmission.com>
In-Reply-To
<Pine.LNX.4.64.0606111735440.5498@g5.osdl.org>
Linus Torvalds <torvalds@osdl.org> writes:
Show 9 quoted lines
> On Sun, 11 Jun 2006, Eric W. Biederman wrote:
>> 
>> This doesn't look like the From: header was in the middle of the
>> message until it was imported into git so it is probably a small
>> logic error that is easily corrected.  But I need to see what
>> we are parsing so I can understand what is happening.
>
> No, it's at the top of the body, although there might have been an empty 
> line or two (ie whitespace only) before it.

Ok. I'm not certain why we would not be ignoring blank lines that we used to skip. The untested patch below should ensure we always skip those lines.

Show 10 quoted lines
>> Even if the header lines are in the middle of the body?
>
> What do you mean by "middle"?
>
> No, it should only look at From: and Subject: lines if they are at the 
> very top, with no other non-whitespace lines above them. But when it looks 
> at them and uses the data from them, it should then remove them from the 
> body - they are "conceptually" just extended header lines that just 
> happened to technically (from an rfc822 standpoint) be in the body of the 
> email.

This is a separate conversation and once the problem of not ignoring leading blank lines is fixed I will be happy to address it.

Eric
diff --git a/mailinfo.c b/mailinfo.c
index 5b6c215..72c5454 100644
--- a/mailinfo.c
+++ b/mailinfo.c
@@ -279,6 +279,14 @@ static void handle_inbody_header(int *se
                        return;
                }
        }
+       /* Ignore leading blank lines */
+       if (!(*seen & SEEN_PREFIX)) {
+               char *ch;
+               for (ch = line; isspace(*ch); ch++)
+                       ;
+               if (*ch == '\0')
+                       return;
+       }
        *seen |= SEEN_PREFIX;
 }
Previous: Linus TorvaldsNext: Eric W. Biederman
Message 4 of 13 in “git-applymbox broken?”
  1. Linus TorvaldsJun 11, 2006
  2. Eric W. BiedermanJun 11, 2006
  3. Linus TorvaldsJun 12, 2006
  4. Eric W. BiedermanJun 12, 2006
  5. Ignore blank lines among this inbody headers.Eric W. Biederman, Jun 12, 2006
  6. Ignore blank lines among this inbody headersEric W. Biederman, Jun 12, 2006
  7. Eric W. BiedermanJun 12, 2006
  8. Linus TorvaldsJun 12, 2006
  9. Don't parse any headers in the real body of an email message.Eric W. Biederman, Jun 12, 2006
  10. Eric W. BiedermanJun 12, 2006
  11. Johannes SchindelinJun 12, 2006
  12. Randy.DunlapJun 12, 2006
  13. Ryan AndersonJun 13, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.