From: Jani Nikula Date: Wed, 11 Sep 2013 17:36:43 +0000 (+0300) Subject: [PATCH v2 2/2] lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init() X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c6f3e66b6cf030b228ece52aff3a0736cf3fbc35;p=notmuch-archives.git [PATCH v2 2/2] lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init() --- diff --git a/57/a1003e025fc6ecd5923e8223d7617374b8ec09 b/57/a1003e025fc6ecd5923e8223d7617374b8ec09 new file mode 100644 index 000000000..827477128 --- /dev/null +++ b/57/a1003e025fc6ecd5923e8223d7617374b8ec09 @@ -0,0 +1,169 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id CC4B6431FC2 + for ; Wed, 11 Sep 2013 10:36:58 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id dmSq6UU7e4Fk for ; + Wed, 11 Sep 2013 10:36:50 -0700 (PDT) +Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com + [74.125.83.54]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client + certificate requested) by olra.theworths.org (Postfix) with ESMTPS id + 2997E431FAE for ; Wed, 11 Sep 2013 10:36:50 -0700 + (PDT) +Received: by mail-ee0-f54.google.com with SMTP id e53so4796355eek.13 + for ; Wed, 11 Sep 2013 10:36:49 -0700 (PDT) +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20130820; + h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to + :references:mime-version:content-type:content-transfer-encoding; + bh=wU5qWneC9ErL8JJ7pYsWGnDM/JX0R6mdfnhcW1F1nOU=; + b=I1kCpiiGzNNrsCVHbAbhVSnKkrLrvF3orqR8ydcqh5256DeiWM7nKKmkHmz6/1TAxf + /ZS9thqwblOEXZq1JGdA4Zrfe0qDoKTI6vprw6tNi6HxmPpzkUNJdRfFedT1qBZqABl/ + Fi7RvH9ZT2ursNvy9W6SSU6/OUr0L8j1JLlgupyGhYXKaXW2OhRLRC3MNHvrJ62R6eyz + xfCjno+zW3vuuw9Feqb5dbI+ydrzS1X9QxNb4UFUgIEta8ciJOG0xfXW1AyII4VsreKL + kMj6xImdRwMwEo0L3hj985Th+pWoRcbc3V/IOAbx1+TEycW4hiVzEyw9uKkH57ey5hsU + xC2g== +X-Gm-Message-State: + ALoCoQmTtTKDhipux0V2MsmQCzBFdFXg4Gn9ugSYBkU9sxbnGqt4R5ulsvck0H2u7hvqppmyON0M +X-Received: by 10.14.224.198 with SMTP id x46mr3895753eep.53.1378921008856; + Wed, 11 Sep 2013 10:36:48 -0700 (PDT) +Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi. + [88.195.111.91]) by mx.google.com with ESMTPSA id + x47sm42075542eea.16.1969.12.31.16.00.00 + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 11 Sep 2013 10:36:48 -0700 (PDT) +From: Jani Nikula +To: notmuch@notmuchmail.org +Subject: [PATCH v2 2/2] lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to + g_mime_init() +Date: Wed, 11 Sep 2013 20:36:43 +0300 +Message-Id: <1378921003-14639-2-git-send-email-jani@nikula.org> +X-Mailer: git-send-email 1.8.4.rc3 +In-Reply-To: <1378921003-14639-1-git-send-email-jani@nikula.org> +References: <8738pcjet4.fsf@awakening.csail.mit.edu> + <1378921003-14639-1-git-send-email-jani@nikula.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Cc: Daniel Kahn Gillmor +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Wed, 11 Sep 2013 17:36:59 -0000 + +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 | 2 +- + lib/index.cc | 2 +- + lib/message-file.c | 2 +- + notmuch.c | 2 +- + test/encoding | 3 --- + 5 files changed, 4 insertions(+), 7 deletions(-) + +diff --git a/lib/database.cc b/lib/database.cc +index 5cc0765..bb4f180 100644 +--- a/lib/database.cc ++++ b/lib/database.cc +@@ -655,7 +655,7 @@ notmuch_database_open (const char *path, + + /* Initialize gmime */ + if (! initialized) { +- g_mime_init (0); ++ g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS); + initialized = 1; + } + +diff --git a/lib/index.cc b/lib/index.cc +index a2edd6d..78c18cf 100644 +--- a/lib/index.cc ++++ b/lib/index.cc +@@ -440,7 +440,7 @@ _notmuch_message_index_file (notmuch_message_t *message, + static bool mbox_warning = false; + + if (! initialized) { +- g_mime_init (0); ++ g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS); + initialized = 1; + } + +diff --git a/lib/message-file.c b/lib/message-file.c +index 4d9af89..a2850c2 100644 +--- a/lib/message-file.c ++++ b/lib/message-file.c +@@ -228,7 +228,7 @@ notmuch_message_file_get_header (notmuch_message_file_t *message, + is_received = (strcmp(header_desired,"received") == 0); + + if (! initialized) { +- g_mime_init (0); ++ g_mime_init (GMIME_ENABLE_RFC2047_WORKAROUNDS); + initialized = 1; + } + +diff --git a/notmuch.c b/notmuch.c +index 78d29a8..7300c21 100644 +--- a/notmuch.c ++++ b/notmuch.c +@@ -264,7 +264,7 @@ main (int argc, char *argv[]) + + 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 +diff --git a/test/encoding b/test/encoding +index 7372b6b..8609652 100755 +--- a/test/encoding ++++ b/test/encoding +@@ -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_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" +-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" +-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)" +-- +1.8.4.rc3 +