[PATCH] mime_node_open: skip envelope from lines at the start of messages

Tomi Ollila tomi.ollila at iki.fi
Sat Mar 10 06:45:35 PST 2012


On Sat, 10 Mar 2012 09:25:31 -0400, David Bremner <david at tethera.net> wrote:
> From: David Bremner <bremner at debian.org>
> 
> Some MDAs such as procmail (in MH mode), and exim (doing local
> delivery in some configurations of the appendfile transport) add a
> line to the front of a message with "From " followed by envelope
> sender.  Since this is not a proper RFC822 header field, gmime (at
> least since version 2.6) refuses to parse it, unless in mbox mode.
> 
> This change reads the line of the file, and if they start with
> "From ", pass the stream to gmime starting from the second line.
> 
> This makes mime_node_open more consistent with (but still stricter
> than) the permissive behaviour of notmuch_file_get_header
> (message-file.c), which allows a certain number of "broken_headers".
> 
> We avoid putting gmime into mbox mode in case of side effects; this
> leaves the situation of mboxes accidentally indexed by notmuch the
> same as before, namely "undefined behaviour".  Ideally they should at
> least be warned by notmuch-new.  Although strict rfc822 adherence
> would be one way to detect mboxes, it doesn't seem to fit with the
> spirit or code of message-file.c.
> ---
> This version fixes a few formatting issues, and one bug (the strncmp).

+1

Tomi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20120310/92028706/attachment.pgp>


More information about the notmuch mailing list