[PATCH v2 2/2] lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init()
authorJani Nikula <jani@nikula.org>
Wed, 11 Sep 2013 17:36:43 +0000 (20:36 +0300)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:57:04 +0000 (09:57 -0800)
57/a1003e025fc6ecd5923e8223d7617374b8ec09 [new file with mode: 0644]

diff --git a/57/a1003e025fc6ecd5923e8223d7617374b8ec09 b/57/a1003e025fc6ecd5923e8223d7617374b8ec09
new file mode 100644 (file)
index 0000000..8274771
--- /dev/null
@@ -0,0 +1,169 @@
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id CC4B6431FC2\r
+       for <notmuch@notmuchmail.org>; Wed, 11 Sep 2013 10:36:58 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id dmSq6UU7e4Fk for <notmuch@notmuchmail.org>;\r
+       Wed, 11 Sep 2013 10:36:50 -0700 (PDT)\r
+Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com\r
+ [74.125.83.54])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 2997E431FAE   for <notmuch@notmuchmail.org>; Wed, 11 Sep 2013 10:36:50 -0700\r
+ (PDT)\r
+Received: by mail-ee0-f54.google.com with SMTP id e53so4796355eek.13\r
+       for <notmuch@notmuchmail.org>; Wed, 11 Sep 2013 10:36:49 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=1e100.net; s=20130820;\r
+       h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+       :references:mime-version:content-type:content-transfer-encoding;\r
+       bh=wU5qWneC9ErL8JJ7pYsWGnDM/JX0R6mdfnhcW1F1nOU=;\r
+       b=I1kCpiiGzNNrsCVHbAbhVSnKkrLrvF3orqR8ydcqh5256DeiWM7nKKmkHmz6/1TAxf\r
+       /ZS9thqwblOEXZq1JGdA4Zrfe0qDoKTI6vprw6tNi6HxmPpzkUNJdRfFedT1qBZqABl/\r
+       Fi7RvH9ZT2ursNvy9W6SSU6/OUr0L8j1JLlgupyGhYXKaXW2OhRLRC3MNHvrJ62R6eyz\r
+       xfCjno+zW3vuuw9Feqb5dbI+ydrzS1X9QxNb4UFUgIEta8ciJOG0xfXW1AyII4VsreKL\r
+       kMj6xImdRwMwEo0L3hj985Th+pWoRcbc3V/IOAbx1+TEycW4hiVzEyw9uKkH57ey5hsU\r
+       xC2g==\r
+X-Gm-Message-State:\r
+ ALoCoQmTtTKDhipux0V2MsmQCzBFdFXg4Gn9ugSYBkU9sxbnGqt4R5ulsvck0H2u7hvqppmyON0M\r
+X-Received: by 10.14.224.198 with SMTP id x46mr3895753eep.53.1378921008856;\r
+       Wed, 11 Sep 2013 10:36:48 -0700 (PDT)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+       [88.195.111.91]) by mx.google.com with ESMTPSA id\r
+       x47sm42075542eea.16.1969.12.31.16.00.00\r
+       (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+       Wed, 11 Sep 2013 10:36:48 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2 2/2] lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to\r
+       g_mime_init()\r
+Date: Wed, 11 Sep 2013 20:36:43 +0300\r
+Message-Id: <1378921003-14639-2-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 1.8.4.rc3\r
+In-Reply-To: <1378921003-14639-1-git-send-email-jani@nikula.org>\r
+References: <8738pcjet4.fsf@awakening.csail.mit.edu>\r
+       <1378921003-14639-1-git-send-email-jani@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 11 Sep 2013 17:36:59 -0000\r
+\r
+As explained by Jeffrey Stedfast, the author of GMime, quoted in [1]:\r
+\r
+> Passing the GMIME_ENABLE_RFC2047_WORKAROUNDS flag to g_mime_init()\r
+> *should* solve the decoding problem mentioned in the thread. This\r
+> flag should be safe to pass into g_mime_init() without any bad side\r
+> effects and my unit tests do test that code-path.\r
+\r
+The thread being referred to is [2].\r
+\r
+[1] id:87bo56viyo.fsf@nikula.org\r
+[2] id:08cb1dcd-c5db-4e33-8b09-7730cb3d59a2@gmail.com\r
+---\r
+ lib/database.cc    | 2 +-\r
+ lib/index.cc       | 2 +-\r
+ lib/message-file.c | 2 +-\r
+ notmuch.c          | 2 +-\r
+ test/encoding      | 3 ---\r
+ 5 files changed, 4 insertions(+), 7 deletions(-)\r
+\r
+diff --git a/lib/database.cc b/lib/database.cc\r
+index 5cc0765..bb4f180 100644\r
+--- a/lib/database.cc\r
++++ b/lib/database.cc\r
+@@ -655,7 +655,7 @@ notmuch_database_open (const char *path,\r
\r
+     /* Initialize gmime */\r
+     if (! initialized) {\r
+-      g_mime_init (0);\r
++      g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);\r
+       initialized = 1;\r
+     }\r
\r
+diff --git a/lib/index.cc b/lib/index.cc\r
+index a2edd6d..78c18cf 100644\r
+--- a/lib/index.cc\r
++++ b/lib/index.cc\r
+@@ -440,7 +440,7 @@ _notmuch_message_index_file (notmuch_message_t *message,\r
+     static bool mbox_warning = false;\r
\r
+     if (! initialized) {\r
+-      g_mime_init (0);\r
++      g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);\r
+       initialized = 1;\r
+     }\r
\r
+diff --git a/lib/message-file.c b/lib/message-file.c\r
+index 4d9af89..a2850c2 100644\r
+--- a/lib/message-file.c\r
++++ b/lib/message-file.c\r
+@@ -228,7 +228,7 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,\r
+     is_received = (strcmp(header_desired,"received") == 0);\r
\r
+     if (! initialized) {\r
+-      g_mime_init (0);\r
++      g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);\r
+       initialized = 1;\r
+     }\r
\r
+diff --git a/notmuch.c b/notmuch.c\r
+index 78d29a8..7300c21 100644\r
+--- a/notmuch.c\r
++++ b/notmuch.c\r
+@@ -264,7 +264,7 @@ main (int argc, char *argv[])\r
\r
+     local = talloc_new (NULL);\r
\r
+-    g_mime_init (0);\r
++    g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);\r
+ #if !GLIB_CHECK_VERSION(2, 35, 1)\r
+     g_type_init ();\r
+ #endif\r
+diff --git a/test/encoding b/test/encoding\r
+index 7372b6b..8609652 100755\r
+--- a/test/encoding\r
++++ b/test/encoding\r
+@@ -30,19 +30,16 @@ output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize)\r
+ test_expect_equal "$output" "thread:0000000000000002   2001-01-05 [1/1] Notmuch Test Suite; ISO-8859-2 encoded message (inbox unread)"\r
\r
+ test_begin_subtest "RFC 2047 encoded word with spaces"\r
+-test_subtest_known_broken\r
+ add_message '[subject]="=?utf-8?q?encoded word with spaces?="'\r
+ output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)\r
+ test_expect_equal "$output" "thread:0000000000000003   2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)"\r
\r
+ test_begin_subtest "RFC 2047 encoded words back to back"\r
+-test_subtest_known_broken\r
+ add_message '[subject]="=?utf-8?q?encoded-words-back?==?utf-8?q?to-back?="'\r
+ output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)\r
+ test_expect_equal "$output" "thread:0000000000000004   2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)"\r
\r
+ test_begin_subtest "RFC 2047 encoded words without space before or after"\r
+-test_subtest_known_broken\r
+ add_message '[subject]="=?utf-8?q?encoded?=word without=?utf-8?q?space?=" '\r
+ output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)\r
+ test_expect_equal "$output" "thread:0000000000000005   2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)"\r
+-- \r
+1.8.4.rc3\r
+\r