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)
committerDavid Bremner <bremner@debian.org>
Sat, 14 Sep 2013 17:13:43 +0000 (14:13 -0300)
As explained by Jeffrey Stedfast, the author of GMime, quoted in [1]:

> Passing the GMIME_ENABLE_RFC2047_WORKAROUNDS flag to g_mime_init()
> *should* solve the decoding problem mentioned in the thread. This
> flag should be safe to pass into g_mime_init() without any bad side
> effects and my unit tests do test that code-path.

The thread being referred to is [2].

[1] id:87bo56viyo.fsf@nikula.org
[2] id:08cb1dcd-c5db-4e33-8b09-7730cb3d59a2@gmail.com

lib/database.cc
lib/index.cc
lib/message-file.c
notmuch.c
test/encoding

index 5cc076587a88785a5801eafcc56df2abef997d20..bb4f1801c133c1bff78dc761271ca31fc75954be 100644 (file)
@@ -655,7 +655,7 @@ notmuch_database_open (const char *path,
 
     /* Initialize gmime */
     if (! initialized) {
 
     /* Initialize gmime */
     if (! initialized) {
-       g_mime_init (0);
+       g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
        initialized = 1;
     }
 
        initialized = 1;
     }
 
index a2edd6d9b6c0795fbdb2512907265000bb54fe21..78c18cf36d10898a8ea3aebcb1c8fe84fcff3df3 100644 (file)
@@ -440,7 +440,7 @@ _notmuch_message_index_file (notmuch_message_t *message,
     static bool mbox_warning = false;
 
     if (! initialized) {
     static bool mbox_warning = false;
 
     if (! initialized) {
-       g_mime_init (0);
+       g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
        initialized = 1;
     }
 
        initialized = 1;
     }
 
index 4d9af89fe44dd5923cee743572149f4cf2c22f46..a2850c278b5a10ba9a5041a6662aab4ed09e3861 100644 (file)
@@ -228,7 +228,7 @@ notmuch_message_file_get_header (notmuch_message_file_t *message,
     is_received = (strcmp(header_desired,"received") == 0);
 
     if (! initialized) {
     is_received = (strcmp(header_desired,"received") == 0);
 
     if (! initialized) {
-       g_mime_init (0);
+       g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
        initialized = 1;
     }
 
        initialized = 1;
     }
 
index 78d29a8194179c05a45ca0934bf955c3bd1f3662..7300c2145ea7c552aa7169a32870e5a154b8453a 100644 (file)
--- a/notmuch.c
+++ b/notmuch.c
@@ -264,7 +264,7 @@ main (int argc, char *argv[])
 
     local = talloc_new (NULL);
 
 
     local = talloc_new (NULL);
 
-    g_mime_init (0);
+    g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS);
 #if !GLIB_CHECK_VERSION(2, 35, 1)
     g_type_init ();
 #endif
 #if !GLIB_CHECK_VERSION(2, 35, 1)
     g_type_init ();
 #endif
index 7372b6b0cd8c2d911344b52e2d126451b8e527ce..8609652caa4438492bf8d2a1da868db268d06379 100755 (executable)
@@ -30,19 +30,16 @@ output=$(notmuch search tučňáččí 2>&1 | notmuch_show_sanitize)
 test_expect_equal "$output" "thread:0000000000000002   2001-01-05 [1/1] Notmuch Test Suite; ISO-8859-2 encoded message (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded word with spaces"
 test_expect_equal "$output" "thread:0000000000000002   2001-01-05 [1/1] Notmuch Test Suite; ISO-8859-2 encoded message (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded word with spaces"
-test_subtest_known_broken
 add_message '[subject]="=?utf-8?q?encoded word with spaces?="'
 output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
 test_expect_equal "$output" "thread:0000000000000003   2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded words back to back"
 add_message '[subject]="=?utf-8?q?encoded word with spaces?="'
 output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
 test_expect_equal "$output" "thread:0000000000000003   2001-01-05 [1/1] Notmuch Test Suite; encoded word with spaces (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded words back to back"
-test_subtest_known_broken
 add_message '[subject]="=?utf-8?q?encoded-words-back?==?utf-8?q?to-back?="'
 output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
 test_expect_equal "$output" "thread:0000000000000004   2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded words without space before or after"
 add_message '[subject]="=?utf-8?q?encoded-words-back?==?utf-8?q?to-back?="'
 output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
 test_expect_equal "$output" "thread:0000000000000004   2001-01-05 [1/1] Notmuch Test Suite; encoded-words-backto-back (inbox unread)"
 
 test_begin_subtest "RFC 2047 encoded words without space before or after"
-test_subtest_known_broken
 add_message '[subject]="=?utf-8?q?encoded?=word without=?utf-8?q?space?=" '
 output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
 test_expect_equal "$output" "thread:0000000000000005   2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)"
 add_message '[subject]="=?utf-8?q?encoded?=word without=?utf-8?q?space?=" '
 output=$(notmuch search id:${gen_msg_id} 2>&1 | notmuch_show_sanitize)
 test_expect_equal "$output" "thread:0000000000000005   2001-01-05 [1/1] Notmuch Test Suite; encodedword withoutspace (inbox unread)"