Segmentation fault at gmime-iconv with python binding
authorKazuo Teramoto <kaz.rag@gmail.com>
Thu, 29 Dec 2011 18:20:33 +0000 (16:20 +2200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:41:24 +0000 (09:41 -0800)
ca/ece13604a6a09a68d27e65a8790f0521d8426e [new file with mode: 0644]

diff --git a/ca/ece13604a6a09a68d27e65a8790f0521d8426e b/ca/ece13604a6a09a68d27e65a8790f0521d8426e
new file mode 100644 (file)
index 0000000..a6585e7
--- /dev/null
@@ -0,0 +1,272 @@
+Return-Path: <kaz.rag@gmail.com>\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 C2AF0431FD0\r
+       for <notmuch@notmuchmail.org>; Thu, 29 Dec 2011 10:20:41 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, 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 OaaXwer9o-ij for <notmuch@notmuchmail.org>;\r
+       Thu, 29 Dec 2011 10:20:40 -0800 (PST)\r
+Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com\r
+       [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7AC5C431FB6\r
+       for <notmuch@notmuchmail.org>; Thu, 29 Dec 2011 10:20:40 -0800 (PST)\r
+Received: by qcha6 with SMTP id a6so10298910qch.26\r
+       for <notmuch@notmuchmail.org>; Thu, 29 Dec 2011 10:20:38 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=message-id:content-type:mime-version:to:from:subject:date;\r
+       bh=DRSaXNXXtS0GSNR+X7Asx7ESmDoUcihSM3pM6TIKuyw=;\r
+       b=DJYdosowf02QZVlPBjAlmGSSPsvdGjWISMgQbIYCWqoPuEzAyIaC/l28kanXBHQ/px\r
+       XenchXSRYuqazrWHQaKJRq6haRn0c5KdKeh9hLyXIWh9zkXxTrMbroahp6jvj+KmNthz\r
+       022hoY04iKp2c5R4VSdi6sZZIKZ7GLrIcmBRc=\r
+Received: by 10.229.111.154 with SMTP id s26mr13324044qcp.93.1325182837563;\r
+       Thu, 29 Dec 2011 10:20:37 -0800 (PST)\r
+Received: from localhost (201-1-35-143.dsl.telesp.net.br. [201.1.35.143])\r
+       by mx.google.com with ESMTPS id h9sm66776727qac.13.2011.12.29.10.20.35\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Thu, 29 Dec 2011 10:20:36 -0800 (PST)\r
+Message-ID: <4efcaf74.491be00a.4c32.ffffd497@mx.google.com>\r
+Content-Type: multipart/mixed; boundary="===============7715145529118809203=="\r
+MIME-Version: 1.0\r
+To: notmuch <notmuch@notmuchmail.org>,\r
+From: Kazuo Teramoto <kaz.rag@gmail.com>\r
+Subject: Segmentation fault at gmime-iconv with python binding\r
+Date: Thu, 29 Dec 2011 16:20:33 -0200\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: Thu, 29 Dec 2011 18:20:41 -0000\r
+\r
+--===============7715145529118809203==\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+Hi!\r
+\r
+When I try to run the attached test.py after adding the attached email\r
+(4EFC743A.3060609_april.org) to notmuch db I got a segmentation fault\r
+(gdb bt attached).\r
+\r
+This is what I think a relevant part of the gdb:\r
+~~~~~~~~\r
+(gdb) frame 1\r
+#1  0x00007ffff5f2759c in g_mime_iconv_open (to=3D0x761ef0 "UTF-8", from=3D=\r
+0x83d590 "iso-8859-1") at gmime-iconv.c:261\r
+261            if ((node =3D (IconvCacheNode *) cache_node_lookup (iconv_cache, key, =\r
+TRUE))) {\r
+(gdb) list\r
+256            key =3D g_alloca (strlen (from) + strlen (to) + 2);\r
+257            sprintf (key, "%s:%s", from, to);\r
+258            =\r
+\r
+259            ICONV_CACHE_LOCK ();\r
+260            =\r
+\r
+261            if ((node =3D (IconvCacheNode *) cache_node_lookup (iconv_cache, key, =\r
+TRUE))) {\r
+262                    if (node->used) {\r
+263                            if ((cd =3D iconv_open (to, from)) =3D=3D (iconv_t) -1)\r
+264                                    goto exception;\r
+265                    } else {\r
+(gdb) print iconv_cache\r
+$1 =3D (Cache *) 0x0\r
+(gdb) =\r
+\r
+~~~~~~~~\r
+\r
+iconv_cache is initialized in g_mime_iconv_init() that is called by\r
+g_mime_init().\r
+\r
+notmuch CLI show the message correct. I know nothing about gmime or\r
+notmuch code, but can this be the case of the python bindings not\r
+calling g_mime_init() correctly?\r
+\r
+Regards,\r
+Kazuo Teramoto\r
+\r
+--===============7715145529118809203==\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+Content-Disposition: attachment; filename="test.py"\r
+\r
+#!/usr/bin/env python2\r
+import notmuch\r
+db =3D notmuch.Database(mode=3Dnotmuch.Database.MODE.READ_WRITE)\r
+q_new =3D notmuch.Query(db, 'id:"4EFC743A.3060609@april.org"')\r
+for t in q_new.search_threads():\r
+    pass\r
+\r
+--===============7715145529118809203==\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+Content-Disposition: attachment; filename="4EFC743A.3060609_april.org"\r
+\r
+Message-ID: <4EFC743A.3060609@april.org>\r
+Date: Thu, 29 Dec 2011 15:07:54 +0100\r
+From: "=3D?ISO-8859-1?Q?Fran=3DE7ois_Boulogne?=3D" <boulogne.f@gmail.com>\r
+User-Agent: Mozilla/5.0 (X11; Linux i686;\r
+ rv:9.0) Gecko/20111224 Thunderbird/9.0.1\r
+MIME-Version: 1.0\r
+To: Allan McRae <allan@archlinux.org>, =\r
+\r
+ "Discussion about the Arch User Repository (AUR)" <aur-general@archlinux.o=\r
+rg>\r
+References: <4EFC3931.6030007@april.org> <4EFC3D62.4030202@archlinux.org>\r
+In-Reply-To: <4EFC3D62.4030202@archlinux.org>\r
+Content-Type: text/plain; charset=3DISO-8859-1\r
+Content-Transfer-Encoding: 8bit\r
+Subject: Re: [aur-general] Guidelines: cp, mkdir vs install\r
+\r
+Le 29/12/2011 11:13, Allan McRae a =C3=A9crit :\r
+> On 29/12/11 19:56, Fran=C3=A7ois Boulogne wrote:\r
+>> Hi,\r
+>>\r
+>> Looking to improve the quality of my packages, I read again the guidelin=\r
+es.\r
+>> https://wiki.archlinux.org/index.php/Arch_Packaging_Standards\r
+>>\r
+>> However, it don't see anything about the install command like\r
+>> install -d $pkgdir/usr/{bin,share/man/man1,share/locale}\r
+>>\r
+>> Some contributors on AUR use cp or mkdir to install files/dir (when no\r
+>> makefile is provided) and others use install command.\r
+>>\r
+>> What's the opinion of TU on this point?\r
+>>\r
+> =\r
+\r
+> Use install with -m specifying the correct permissions\r
+> =\r
+\r
+\r
+Thank you Allan\r
+\r
+\r
+-- =\r
+\r
+Fran=C3=A7ois Boulogne.\r
+https://www.sciunto.org\r
+\r
+--===============7715145529118809203==\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+Content-Disposition: attachment; filename="notmuch_py_gmime.gdb_bt"\r
+\r
+GNU gdb (GDB) 7.3.1\r
+Copyright (C) 2011 Free Software Foundation, Inc.\r
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.htm=\r
+l>\r
+This is free software: you are free to change and redistribute it.\r
+There is NO WARRANTY, to the extent permitted by law.  Type "show copying"\r
+and "show warranty" for details.\r
+This GDB was configured as "x86_64-unknown-linux-gnu".\r
+For bug reporting instructions, please see:\r
+<http://www.gnu.org/software/gdb/bugs/>...\r
+Reading symbols from /usr/bin/python2...(no debugging symbols found)...done.\r
+(gdb) run\r
+Starting program: /usr/bin/python2 test.py\r
+[Thread debugging using libthread_db enabled]\r
+\r
+Program received signal SIGSEGV, Segmentation fault.\r
+0x00007ffff5f4fd82 in cache_node_lookup (cache=3D0x0, key=3D0x7fffffffaab0 =\r
+"iso-8859-1:UTF-8", use=3D1) at cache.c:110\r
+110            node =3D g_hash_table_lookup (cache->node_hash, key);\r
+(gdb) bt\r
+#0  0x00007ffff5f4fd82 in cache_node_lookup (cache=3D0x0, key=3D0x7fffffffa=\r
+ab0 "iso-8859-1:UTF-8", use=3D1) at cache.c:110\r
+#1  0x00007ffff5f2759c in g_mime_iconv_open (to=3D0x761ef0 "UTF-8", from=3D=\r
+0x83d590 "iso-8859-1") at gmime-iconv.c:261\r
+#2  0x00007ffff5f4633f in rfc2047_decode_word (in=3D0x82f350 "=3D?ISO-8859-=\r
+1?Q?Fran=3DE7ois_Boulogne?=3D", inlen=3D36) at gmime-utils.c:1839\r
+#3  0x00007ffff5f46ad1 in g_mime_utils_header_decode_phrase (phrase=3D0x82f=\r
+350 "=3D?ISO-8859-1?Q?Fran=3DE7ois_Boulogne?=3D") at gmime-utils.c:2084\r
+#4  0x00007ffff5f4a759 in _internet_address_decode_name (ia=3D0x83d630, nam=\r
+e=3D0x88fae0) at internet-address.c:1367\r
+#5  0x00007ffff5f4afab in decode_address (in=3D0x7fffffffad60) at internet-=\r
+address.c:1659\r
+#6  0x00007ffff5f4b003 in internet_address_list_parse_string (str=3D0x76653=\r
+0 "\"=3D?ISO-8859-1?Q?Fran=3DE7ois_Boulogne?=3D\" <boulogne.f@gmail.com>") =\r
+at internet-address.c:1692\r
+#7  0x00007ffff61915d7 in _thread_add_message (thread=3D0x6d99d0, message=\r
+=3D0x6d9330) at lib/thread.cc:236\r
+#8  0x00007ffff6191dd7 in _notmuch_thread_create (ctx=3D0x7d54e0, notmuch=\r
+=3D0x6e01d0, seed_doc_id=3D213092, match_set=3D0x83c888, sort=3DNOTMUCH_SOR=\r
+T_NEWEST_FIRST) at lib/thread.cc:470\r
+#9  0x00007ffff61906b7 in notmuch_threads_get (threads=3D0x83c870) at lib/q=\r
+uery.cc:392\r
+#10 0x00007ffff65a7e34 in ffi_call_unix64 () from /usr/lib/libffi.so.5\r
+#11 0x00007ffff65a7855 in ffi_call () from /usr/lib/libffi.so.5\r
+#12 0x00007ffff67bb1f7 in _ctypes_callproc () from /usr/lib/python2.7/lib-d=\r
+ynload/_ctypes.so\r
+#13 0x00007ffff67b4a86 in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes=\r
+.so\r
+#14 0x00007ffff7a66683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0\r
+#15 0x00007ffff7afbbda in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.=\r
+so.1.0\r
+#16 0x00007ffff7afe8ef in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.s=\r
+o.1.0\r
+#17 0x00007ffff7a8b15c in function_call () from /usr/lib/libpython2.7.so.1.0\r
+#18 0x00007ffff7a66683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0\r
+#19 0x00007ffff7a752bf in instancemethod_call () from /usr/lib/libpython2.7=\r
+.so.1.0\r
+#20 0x00007ffff7a66683 in PyObject_Call () from /usr/lib/libpython2.7.so.1.0\r
+#21 0x00007ffff7abc002 in call_method () from /usr/lib/libpython2.7.so.1.0\r
+#22 0x00007ffff7af8b1f in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.=\r
+so.1.0\r
+#23 0x00007ffff7afe8ef in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.s=\r
+o.1.0\r
+#24 0x00007ffff7afea22 in PyEval_EvalCode () from /usr/lib/libpython2.7.so.=\r
+1.0\r
+#25 0x00007ffff7b18d8c in run_mod () from /usr/lib/libpython2.7.so.1.0\r
+#26 0x00007ffff7b19b90 in PyRun_FileExFlags () from /usr/lib/libpython2.7.s=\r
+o.1.0\r
+#27 0x00007ffff7b1a60f in PyRun_SimpleFileExFlags () from /usr/lib/libpytho=\r
+n2.7.so.1.0\r
+#28 0x00007ffff7b2bd25 in Py_Main () from /usr/lib/libpython2.7.so.1.0\r
+#29 0x00007ffff747e38d in __libc_start_main () from /lib/libc.so.6\r
+#30 0x00000000004006a1 in _start ()\r
+(gdb) frame 1\r
+#1  0x00007ffff5f2759c in g_mime_iconv_open (to=3D0x761ef0 "UTF-8", from=3D=\r
+0x83d590 "iso-8859-1") at gmime-iconv.c:261\r
+261            if ((node =3D (IconvCacheNode *) cache_node_lookup (iconv_cache, key, =\r
+TRUE))) {\r
+(gdb) list\r
+256            key =3D g_alloca (strlen (from) + strlen (to) + 2);\r
+257            sprintf (key, "%s:%s", from, to);\r
+258            =\r
+\r
+259            ICONV_CACHE_LOCK ();\r
+260            =\r
+\r
+261            if ((node =3D (IconvCacheNode *) cache_node_lookup (iconv_cache, key, =\r
+TRUE))) {\r
+262                    if (node->used) {\r
+263                            if ((cd =3D iconv_open (to, from)) =3D=3D (iconv_t) -1)\r
+264                                    goto exception;\r
+265                    } else {\r
+(gdb) print iconv_cache\r
+$1 =3D (Cache *) 0x0\r
+(gdb)=20\r
+--===============7715145529118809203==--\r