heads up from the python front
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Sun, 22 Jan 2012 14:01:41 +0000 (14:01 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:42:54 +0000 (09:42 -0800)
d7/d97ec75dae9a0641c0f0c50de4c656f4d9112a [new file with mode: 0644]

diff --git a/d7/d97ec75dae9a0641c0f0c50de4c656f4d9112a b/d7/d97ec75dae9a0641c0f0c50de4c656f4d9112a
new file mode 100644 (file)
index 0000000..16dbe5a
--- /dev/null
@@ -0,0 +1,145 @@
+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 2D481429E54\r
+       for <notmuch@notmuchmail.org>; Sat, 21 Jan 2012 22:01:50 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Date"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.432\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.432 tagged_above=-999 required=5\r
+       tests=[INVALID_DATE=0.432] 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 aV+IMnpwJDlk for <notmuch@notmuchmail.org>;\r
+       Sat, 21 Jan 2012 22:01:49 -0800 (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 3D5CD429E40\r
+       for <notmuch@notmuchmail.org>; Sat, 21 Jan 2012 22:01:49 -0800 (PST)\r
+Received: from mail.jade-hamburg.de (unknown [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 1A0C85102A5\r
+       for <notmuch@notmuchmail.org>; Sun, 22 Jan 2012 07:01:47 +0100 (CET)\r
+Received: by mail.jade-hamburg.de (Postfix, from userid 401)\r
+       id 4FD8CDF2A3; Sun, 22 Jan 2012 07:01:46 +0100 (CET)\r
+Received: from thinkbox.jade-hamburg.de (unknown [10.1.1.109])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested) (Authenticated sender: teythoon)\r
+       by mail.jade-hamburg.de (Postfix) with ESMTPSA id 6CF39DF2A1\r
+       for <notmuch@notmuchmail.org>; Sun, 22 Jan 2012 07:01:42 +0100 (CET)\r
+Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77)\r
+       (envelope-from <teythoon@thinkbox.jade-hamburg.de>)\r
+       id 1RoqUn-0007d5-DL\r
+       for notmuch@notmuchmail.org; Sun, 22 Jan 2012 07:01:41 +0100\r
+Content-Type: text/plain; charset="utf-8"\r
+MIME-Version: 1.0\r
+Content-Transfer-Encoding: quoted-printable\r
+Date: Sun, 22 Jan 2012 06:01:41 -0000\r
+To: notmuch mailing list <notmuch@notmuchmail.org>\r
+Message-ID: <20120122060141.16806.41461@thinkbox.jade-hamburg.de>\r
+From: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+Subject: heads up from the python front\r
+Date: Sun, 22 Jan 2012 07:01:41 +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: Sun, 22 Jan 2012 06:01:50 -0000\r
+\r
+Hey everyone :)\r
+\r
+after getting to know nmbug a little better (it's actually very nice\r
+to track bugs and patches this way...) I did some work on the python\r
+bindings. tl;dr version: housekeeping, python3.2 support, fixed nasty\r
+bug.\r
+\r
+I familiarized myself with nmbug and went through all the threads\r
+tagged with notmuch::python, added and updated few tags here and there\r
+and started working on the open issues.\r
+\r
+Python 3.2 support\r
+------------------\r
+\r
+I merged the last patch of a patchset[0] I wrote in december that makes\r
+it possible to use the python bindings with both python2.x and\r
+python3.2.\r
+\r
+I do not now how complete the port is, most notably the notmuch.py\r
+script does not work with 3.x. But it is complete enough to make\r
+afew[1] work using python3.2 and the vanilla notmuch bindings.\r
+\r
+If you want to help out and have a small script that uses the bindings\r
+I'd like to invite you to try to port your script and report any\r
+issues.\r
+\r
+Fix random crashes when using the bindings\r
+------------------------------------------\r
+\r
+I found a nasty bug I introduced with a patchset[2] that was supposed\r
+to make the bindings more robust. Annotating pointers returned from\r
+libnotmuch functions called using ctypes allows the ctypes framework\r
+to do typechecking. But I accidentally broke the error handling\r
+code. Citing the commit message:\r
+\r
+    Before 3434d1940 the return values of libnotmuch functions were\r
+    declared as c_void_p and the code checking for errors compared the\r
+    returned value to None, which is the ctypes equivalent of a NULL\r
+    pointer.\r
+\r
+    But said commit wrapped all the data types in python classes and the\r
+    semantic changed in a subtle way. If a function returns NULL, the\r
+    wrapped python value is falsish, but no longer equal to None.\r
+\r
+In fact the minimal test case triggering the bug is:\r
+\r
+    import os\r
+    import notmuch\r
+\r
+    db_path =3D os.path.expanduser('~/Maildir')\r
+\r
+    db_0 =3D notmuch.Database(db_path, mode=3Dnotmuch.Database.MODE.READ_WR=\r
+ITE)\r
+    db_1 =3D notmuch.Database(db_path, mode=3Dnotmuch.Database.MODE.READ_WR=\r
+ITE)\r
+\r
+The problem was most apparent when opening the database fails because\r
+it has been locked by someone else. The patch regarding the function\r
+Database.open looks like this:\r
+\r
+         res =3D Database._open(_str(path), mode)\r
+ =\r
+\r
+-        if res is None:\r
++        if not res:\r
+             raise NotmuchError(message=3D"Could not open the specified dat=\r
+abase")\r
+         self._db =3D res\r
+\r
+The old code fails to notify the callee of the error who causes a\r
+segfault later if he uses that database reference which is in fact\r
+NULL.\r
+\r
+I feel kind of bad since I severely broke the error handling for all\r
+pythonic notmuch users out there, is there any chance of a bugfix\r
+release? The patch[3] is really simple and I'd say it's trivial to\r
+backport it to the last release. What do you think?\r
+\r
+Justus\r
+\r
+0: id:1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de\r
+1: https://github.com/teythoon/afew\r
+2: id:1318198374-926-1-git-send-email-4winter@informatik.uni-hamburg.de\r
+3: 8015cbff263606f009b5750d23b28ee332c25db8\r