From dd835abbe8612acf8d28f9fd15a3e1e5daf3c7fd Mon Sep 17 00:00:00 2001 From: Austin Clements Date: Wed, 11 Sep 2013 22:02:47 +2000 Subject: [PATCH] Re: [PATCH] lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to g_mime_init() --- 2c/5a0a3df86cff2699da66442856480ff762d393 | 167 ++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 2c/5a0a3df86cff2699da66442856480ff762d393 diff --git a/2c/5a0a3df86cff2699da66442856480ff762d393 b/2c/5a0a3df86cff2699da66442856480ff762d393 new file mode 100644 index 000000000..94e59cef8 --- /dev/null +++ b/2c/5a0a3df86cff2699da66442856480ff762d393 @@ -0,0 +1,167 @@ +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 148EB431FAF + for ; Tue, 10 Sep 2013 19:03:05 -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 bmokPi2Za+JQ for ; + Tue, 10 Sep 2013 19:02:57 -0700 (PDT) +Received: from dmz-mailsec-scanner-3.mit.edu (dmz-mailsec-scanner-3.mit.edu + [18.9.25.14]) + by olra.theworths.org (Postfix) with ESMTP id 308D4431FAE + for ; Tue, 10 Sep 2013 19:02:57 -0700 (PDT) +X-AuditID: 1209190e-b7f988e0000009a7-b9-522fcf4f6bb2 +Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) + by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP + id 5E.4F.02471.F4FCF225; Tue, 10 Sep 2013 22:02:55 -0400 (EDT) +Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) + by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r8B22rLY020427; + Tue, 10 Sep 2013 22:02:54 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r8B22qpM006425 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Tue, 10 Sep 2013 22:02:53 -0400 +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1VJZlY-0001Wd-NT; Tue, 10 Sep 2013 22:02:50 -0400 +From: Austin Clements +To: Jani Nikula , notmuch@notmuchmail.org +Subject: Re: [PATCH] lib/cli: pass GMIME_ENABLE_RFC2047_WORKAROUNDS to + g_mime_init() +In-Reply-To: <1378839078-6298-1-git-send-email-jani@nikula.org> +References: <1378839078-6298-1-git-send-email-jani@nikula.org> +User-Agent: Notmuch/0.16+37~g9701e9c (http://notmuchmail.org) Emacs/23.4.1 + (i486-pc-linux-gnu) +Date: Tue, 10 Sep 2013 22:02:47 -0400 +Message-ID: <8738pcjet4.fsf@awakening.csail.mit.edu> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsUixCmqret/Xj/IYO9kHoum6c4W12/OZHZg + 8rh1/zW7x7NVt5gDmKK4bFJSczLLUov07RK4MqZOvcNUcFqi4vGikywNjFeFuxg5OSQETCQu + nrzPCGGLSVy4t54NxBYS2McocXgadxcjF5C9kVGi6/YjZgjnNJPEojuv2SGcJYwSrw8vZQdp + YRPQkNi2fznYKBEBK4lzD1+zgNjCAiESy96sYgWxOQXsJRY332GBWGEnMfXLCmYQW1QgTuJa + 50KwOIuAqsS7/ZfA4rxA532cMJ8NwhaUODnzCVgNs4CWxI1/L5kmMArMQpKahSS1gJFpFaNs + Sm6Vbm5iZk5xarJucXJiXl5qka6xXm5miV5qSukmRnBASvLtYPx6UOkQowAHoxIPr4GifpAQ + a2JZcWXuIUZJDiYlUV7nk0AhvqT8lMqMxOKM+KLSnNTiQ4wSHMxKIrxTnYByvCmJlVWpRfkw + KWkOFiVx3vUgKYH0xJLU7NTUgtQimKwMB4eSBG/EOaCsYFFqempFWmZOCUKaiYMTZDgP0PCF + Z0GGFxck5hZnpkPkTzEqSonzqoE0C4AkMkrz4HphCeMVozjQK8K8miBVPMBkA9f9CmgwE9Dg + 775gg0sSEVJSDYwq6anZhwPEI9be3GZ/+uq/sujyi6/WPny1xPDU6cZZwq+9FrWbcRe//v77 + 1lzRhMDMxW8vLvjVzy1q3/v56YybF03La9ueM+yQNjKUllmyN9Ti2cwXx5elC1ocbUhnEVDM + V39x44/39a0N/sLXL73asTpOTDO35OH1A0Jd+5oYl9+bk/3cWTNbiaU4I9FQi7moOBEAJiI+ + cvMCAAA= +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 02:03:05 -0000 + +LGTM in principle, though I'd like to see a test of some of the +malformed RFC 2047 that this lets us decode. Is there a summary +somewhere of exactly what these workarounds enable? + +This isn't directly related to this patch, but is there a reason we +g_mime_init in so many different places? Both the CLI and +notmuch_database_open I can understand because the CLI also uses GMime +and should be sure it's initialized. Maaaybe +notmuch_message_file_get_header because notmuch_message_file +theoretically independent of the database, even though I don't think +it's possible to call into it without first calling +notmuch_database_open. But _notmuch_message_index_file? + +On Tue, 10 Sep 2013, Jani Nikula wrote: +> 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 +- +> 4 files changed, 4 insertions(+), 4 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 +> -- +> 1.8.4.rc3 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2