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

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

Date: Sat, 10 Mar 2012 16:45:35 +0200

To: David Bremner, notmuch@notmuchmail.org

Cc: David Bremner

From: Tomi Ollila


On Sat, 10 Mar 2012 09:25:31 -0400, David Bremner <david@tethera.net> wrote:
> From: David Bremner <bremner@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
part-000.sig (application/pgp-signature)

Thread: