[WIP PATCH] debugging gmime-2.6 fail.

David Bremner david at tethera.net
Thu Mar 8 07:35:35 PST 2012


From: David Bremner <bremner at debian.org>

Try parsing again as mbox if the first one failed.
---
I ran out of time for the moment, but the following patch gets me down from 
4196 failures on the notmuch mailing list to 3422.

I'm leaning to reverting back to gmime-2.4 for the Debian 0.12 package
if I can't sort this out.

 mime-node.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/mime-node.c b/mime-node.c
index a95bdab..1d3a184 100644
--- a/mime-node.c
+++ b/mime-node.c
@@ -111,8 +111,17 @@ mime_node_open (const void *ctx, notmuch_message_t *message,
 	goto DONE;
     }
 
+
     mctx->mime_message = g_mime_parser_construct_message (mctx->parser);
     if (!mctx->mime_message) {
+	/*
+	 * Parsing failed, let's try again as an mbox
+	 */
+	mctx->parser = g_mime_parser_new_with_stream (mctx->stream);
+	mctx->mime_message = g_mime_parser_construct_message (mctx->parser);
+    }
+
+    if (!mctx->mime_message) {
 	fprintf (stderr, "Failed to parse %s\n", filename);
 	status = NOTMUCH_STATUS_FILE_ERROR;
 	goto DONE;
-- 
1.7.9.1



More information about the notmuch mailing list