Thread (1 message) 1 message, 1 author, 2016-06-15

Re: git-applymbox broken?

From: Eric W. Biederman <hidden>
Date: 2016-06-15 22:42:29
Subsystem: the rest · Maintainer: Linus Torvalds

Possibly related (same subject, not in this thread)

Linus Torvalds [off-list ref] writes:
On Sun, 11 Jun 2006, Eric W. Biederman wrote:
quoted
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.

quoted
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;
 }
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help