--- /dev/null
+Return-Path: <teythoon@jade-hamburg.de>\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 0E369431FBC\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 08:40:29 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+ 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 Ez7wGiwbOeS3 for <notmuch@notmuchmail.org>;\r
+ Fri, 24 Jan 2014 08:40:24 -0800 (PST)\r
+X-Greylist: delayed 385 seconds by postgrey-1.32 at olra;\r
+ Fri, 24 Jan 2014 08:40:24 PST\r
+Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])\r
+ (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 73AA7431FB6\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 08:40:24 -0800 (PST)\r
+Received: from mail.jade-hamburg.de (mail.jade-hamburg.de [85.183.11.228])\r
+ (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by mail.cryptobitch.de (Postfix) with ESMTPSA id 72AD070DD0D\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 17:33:54 +0100 (CET)\r
+Received: by mail.jade-hamburg.de (Postfix, from userid 401)\r
+ id C86DEDF2A2; Fri, 24 Jan 2014 17:33:07 +0100 (CET)\r
+Received: from thinkbox.jade-hamburg.de (cryptobitch.de [88.198.7.68])\r
+ (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits))\r
+ (No client certificate requested) (Authenticated sender: teythoon)\r
+ by mail.jade-hamburg.de (Postfix) with ESMTPSA id 04425DF28B;\r
+ Fri, 24 Jan 2014 17:33:03 +0100 (CET)\r
+Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.80)\r
+ (envelope-from <teythoon@thinkbox.jade-hamburg.de>)\r
+ id 1W6jgk-00019F-KY; Fri, 24 Jan 2014 17:33:02 +0100\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+From: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+User-Agent: alot/0.3.4\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+References:\r
+ <1318198374-926-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
+ <1318198374-926-2-git-send-email-4winter@informatik.uni-hamburg.de>\r
+ <4eddf2b1.4288980a.0b74.5557@mx.google.com> <87fwgx7vmm.fsf@SSpaeth.de>\r
+ <E1RYMoW-0004Sc-R1@thinkbox.jade-hamburg.de> <87r47xpli0.fsf@zancas.localnet>\r
+In-Reply-To: <87r47xpli0.fsf@zancas.localnet>\r
+Message-ID: <20140124163302.2392.83892@thinkbox.jade-hamburg.de>\r
+Subject: Re: [PATCH 2/2] python: annotate all calls into libnotmuch with types\r
+Date: Fri, 24 Jan 2014 17:33:02 +0100\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: Fri, 24 Jan 2014 16:40:29 -0000\r
+\r
+Hi :)\r
+\r
+Quoting David Bremner (2014-01-24 14:17:27)\r
+> Justus Winter <4winter@informatik.uni-hamburg.de> writes:\r
+> =\r
+\r
+> > Quoting Justus Winter (2011-12-07 19:49:31)\r
+> =\r
+\r
+> > And another one:\r
+> [stack trace snipped]\r
+> > #69 0x00000000004e10be in PyRun_SimpleFileExFlags (fp=3D0xb99c10, filen=\r
+ame=3D<optimized out>, closeit=3D1, flags=3D0x7fffc13a1f60) at ../Python/py=\r
+thonrun.c:936\r
+> > #70 0x00000000004f10fd in Py_Main (argc=3D<optimized out>, argv=3D<opti=\r
+mized out>) at ../Modules/main.c:599\r
+> > #71 0x00007f72f2cbaead in __libc_start_main (main=3D<optimized out>, ar=\r
+gc=3D<optimized out>, ubp_av=3D<optimized out>, init=3D<optimized out>, fin=\r
+i=3D<optimized out>, =\r
+\r
+> > rtld_fini=3D<optimized out>, stack_end=3D0x7fffc13a2078) at libc-st=\r
+art.c:228\r
+> > #72 0x000000000041f199 in _start ()\r
+> > (gdb) q\r
+> >\r
+> > with stderr saying:\r
+> >\r
+> > terminate called after throwing an instance of 'Xapian::DatabaseModifie=\r
+dError'\r
+> > Aborted (core dumped)\r
+> >\r
+> > This is an uncought c++ exception, right? If so I think it has to be\r
+> > cought somewhere in libnotmuch and turned into the appropriate error\r
+> > code (hm, there is only the generic XAPIAN_EXCEPTION, I thought there\r
+> > was a way to indicate that the db has been modified?).\r
+> =\r
+\r
+> Can you still reproduce this bug? If so, a small test case (python is\r
+> fine, but ideally not requiring afew) would be helpful.\r
+\r
+I'm sorry, I've no idea how to reproduce this. I have, however, some\r
+more test cases that crash libnotmuch, like this one:\r
+\r
+~~~ snap ~~~\r
+import os\r
+import notmuch\r
+\r
+db_path =3D os.path.expanduser('~/Maildir')\r
+\r
+db =3D notmuch.Database(db_path, mode=3Dnotmuch.Database.MODE.READ_WRITE)\r
+directory =3D db.get_directory(os.path.join(db_path, 'cur'))\r
+db._destroy(db._db)\r
+\r
+try:\r
+ directory.get_child_files()\r
+except notmuch.errors.NotInitializedError as e:\r
+ print('yeah')\r
+else:\r
+ assert False, "Hey, where's my exception?"\r
+~~~ snap ~~~\r
+\r
+% python destroy_minimal.py\r
+[2] 3907 abort (core dumped) python destroy_minimal.py\r
+\r
+Program terminated with signal 6, Aborted.\r
+#0 0x00007f996ad021d5 in __GI_raise (sig=3Dsig@entry=3D6) at ../nptl/sysde=\r
+ps/unix/sysv/linux/raise.c:56\r
+56 ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.\r
+(gdb) bt\r
+#0 0x00007f996ad021d5 in __GI_raise (sig=3Dsig@entry=3D6) at ../nptl/sysde=\r
+ps/unix/sysv/linux/raise.c:56\r
+#1 0x00007f996ad05388 in __GI_abort () at abort.c:90\r
+#2 0x00007f99699d4486 in talloc_abort (reason=3D0x7f99699db648 "Bad talloc=\r
+ magic value - access after free") at ../talloc.c:317\r
+#3 0x00007f99699d8097 in talloc_abort_access_after_free () at ../talloc.c:=\r
+336\r
+#4 talloc_chunk_from_ptr (ptr=3D0x23e6f20) at ../talloc.c:357\r
+#5 talloc_chunk_from_ptr (ptr=3D0x23e6f20) at ../talloc.c:2064\r
+#6 __talloc (size=3D17, context=3D0x23e6f20) at ../talloc.c:555\r
+#7 talloc_vasprintf (t=3D<optimized out>, fmt=3D0x7f996a3a56ef "%s%u:", ap=\r
+=3D0x7fffb612bff8) at ../talloc.c:2079\r
+#8 0x00007f99699d8167 in talloc_asprintf (t=3D<optimized out>, fmt=3D<opti=\r
+mized out>) at ../talloc.c:2101\r
+#9 0x00007f996a39c02e in notmuch_directory_get_child_files () from /home/t=\r
+eythoon/.local/lib/libnotmuch.so.3\r
+#10 0x00007f996a5b1cfc in ffi_call_unix64 () from /usr/lib/x86_64-linux-gnu=\r
+/libffi.so.6\r
+#11 0x00007f996a5b162c in ffi_call () from /usr/lib/x86_64-linux-gnu/libffi=\r
+.so.6\r
+#12 0x00007f996a7c86d0 in _ctypes_callproc () from /usr/lib/python2.7/lib-d=\r
+ynload/_ctypes.x86_64-linux-gnu.so\r
+#13 0x00007f996a7ca08e in PyCFuncPtr_call.3149.2622 () from /usr/lib/python=\r
+2.7/lib-dynload/_ctypes.x86_64-linux-gnu.so\r
+#14 0x000000000055f47a in PyEval_EvalFrameEx () at ../Objects/abstract.c:25=\r
+29\r
+#15 0x000000000055f7ba in PyEval_EvalFrameEx () at ../Python/ceval.c:4107\r
+#16 0x0000000000566bfb in PyEval_EvalCode () at ../Python/ceval.c:3253\r
+#17 0x0000000000469499 in run_mod.42569 () at ../Python/pythonrun.c:1370\r
+#18 0x0000000000469819 in PyRun_FileExFlags () at ../Python/pythonrun.c:1356\r
+#19 0x0000000000469d52 in PyRun_SimpleFileExFlags () at ../Python/pythonrun=\r
+.c:948\r
+#20 0x000000000046b65f in Py_Main () at ../Modules/main.c:640\r
+#21 0x00007f996acee995 in __libc_start_main (main=3D0x46b71d <main>, argc=\r
+=3D2, ubp_av=3D0x7fffb612ca58, init=3D<optimized out>, fini=3D<optimized ou=\r
+t>, rtld_fini=3D<optimized out>, =\r
+\r
+ stack_end=3D0x7fffb612ca48) at libc-start.c:276\r
+#22 0x0000000000573f2e in _start ()\r
+\r
+This is a bit contrived b/c I'm destroying the db object by\r
+hand. Never the less libnotmuch calls abort, and there is no way to\r
+contain something like this in the python bindings.\r
+\r
+I've seen your recent proposal to improve the error reporting for\r
+libnotmuch functions. I think it's awesome, albeit a little late.\r
+\r
+I've no idea how other frontends deal with libnotmuch, but alot has\r
+moved libnotmuch to it's own process to contain any crashes (or\r
+libnotmuch calling exit(3)), and to prevent libnotmuch from writing to\r
+stderr destroying alots curses gui. I've always felt like libnotmuch\r
+users were second-class citizens, the primary target of libnotmuch\r
+being the notmuch binary.\r
+\r
+Justus\r