1 Return-Path: <bremner@tethera.net>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 04E92429E25
\r
6 for <notmuch@notmuchmail.org>; Sat, 31 Dec 2011 19:23:00 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id mCla+WkzyUAs for <notmuch@notmuchmail.org>;
\r
16 Sat, 31 Dec 2011 19:22:58 -0800 (PST)
\r
17 Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21])
\r
18 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 07751431FB6
\r
21 for <notmuch@notmuchmail.org>; Sat, 31 Dec 2011 19:22:57 -0800 (PST)
\r
22 Received: from zancas.localnet
\r
23 (fctnnbsc36w-156034079193.pppoe-dynamic.High-Speed.nb.bellaliant.net
\r
24 [156.34.79.193]) (authenticated bits=0)
\r
25 by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id q013Mrsm017592
\r
26 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO);
\r
27 Sat, 31 Dec 2011 23:22:54 -0400
\r
28 Received: from bremner by zancas.localnet with local (Exim 4.77)
\r
29 (envelope-from <bremner@tethera.net>)
\r
30 id 1RhC0b-0002DA-56; Sat, 31 Dec 2011 23:22:53 -0400
\r
31 From: David Bremner <david@tethera.net>
\r
32 To: notmuch@notmuchmail.org
\r
33 Subject: [PATCH v2 3/3] lib: call g_mime_init() from notmuch_database_open()
\r
34 Date: Sat, 31 Dec 2011 23:22:49 -0400
\r
35 Message-Id: <1325388169-8444-4-git-send-email-david@tethera.net>
\r
36 X-Mailer: git-send-email 1.7.7.3
\r
37 In-Reply-To: <1325388169-8444-1-git-send-email-david@tethera.net>
\r
38 References: <1325306261-21444-2-git-send-email-kaz.rag@gmail.com>
\r
39 <1325388169-8444-1-git-send-email-david@tethera.net>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Sun, 01 Jan 2012 03:23:00 -0000
\r
54 From: Kazuo Teramoto <kaz.rag@gmail.com>
\r
57 id:"CAEbOPGyuHnz4BPtDutnTPUHcP3eYcRCRkXhYoJR43RUMw671+g@mail.gmail.com"
\r
58 sometimes gmime tries to access a NULL pointer, e.g. g_mime_iconv_open()
\r
59 tries to access iconv_cache that is NULL if g_mime_init() is not called.
\r
60 This causes notmuch to segfault when calling gmime functions.
\r
62 Calling g_mime_init() initializes iconv_cache and others variables needed
\r
63 by gmime, making sure they are initialized when notmuch calls gmime
\r
66 Test marked fix by db.
\r
68 lib/database.cc | 9 +++++++++
\r
70 2 files changed, 9 insertions(+), 1 deletions(-)
\r
72 diff --git a/lib/database.cc b/lib/database.cc
\r
73 index d11dfaf..8103bd9 100644
\r
74 --- a/lib/database.cc
\r
75 +++ b/lib/database.cc
\r
77 #include <glib.h> /* g_free, GPtrArray, GHashTable */
\r
78 #include <glib-object.h> /* g_type_init */
\r
80 +#include <gmime/gmime.h> /* g_mime_init */
\r
82 using namespace std;
\r
84 #define ARRAY_SIZE(arr) (sizeof (arr) / sizeof (arr[0]))
\r
85 @@ -585,6 +587,7 @@ notmuch_database_open (const char *path,
\r
88 unsigned int i, version;
\r
89 + static int initialized = 0;
\r
91 if (asprintf (¬much_path, "%s/%s", path, ".notmuch") == -1) {
\r
92 notmuch_path = NULL;
\r
93 @@ -608,6 +611,12 @@ notmuch_database_open (const char *path,
\r
94 /* Initialize the GLib type system and threads */
\r
97 + /* Initialize gmime */
\r
98 + if (! initialized) {
\r
103 notmuch = talloc (NULL, notmuch_database_t);
\r
104 notmuch->exception_reported = FALSE;
\r
105 notmuch->path = talloc_strdup (notmuch, path);
\r
106 diff --git a/test/python b/test/python
\r
107 index 0b56db3..c3aa726 100755
\r
110 @@ -5,7 +5,6 @@ test_description="python bindings"
\r
113 test_begin_subtest "compare thread ids"
\r
114 -test_subtest_known_broken
\r
117 db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)
\r