Re: [PATCH] emacs: address completion, allow sender/recipient and filters
[notmuch-archives.git] / 3e / 55b63cdc7033db2fc3af9024dc75c20064abc0
1 Return-Path: <teythoon@jade-hamburg.de>\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 8B820431FAF\r
6         for <notmuch@notmuchmail.org>; Mon, 20 Feb 2012 16:29:30 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "Date"\r
9 X-Spam-Flag: NO\r
10 X-Spam-Score: 0.432\r
11 X-Spam-Level: \r
12 X-Spam-Status: No, score=0.432 tagged_above=-999 required=5\r
13         tests=[INVALID_DATE=0.432] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id aSJ7quxRkytu for <notmuch@notmuchmail.org>;\r
17         Mon, 20 Feb 2012 16:29:29 -0800 (PST)\r
18 Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])\r
19         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id D22A9431FAE\r
22         for <notmuch@notmuchmail.org>; Mon, 20 Feb 2012 16:29:28 -0800 (PST)\r
23 Received: from mail.jade-hamburg.de (unknown [85.183.11.228])\r
24         (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
25         (No client certificate requested)\r
26         by mail.cryptobitch.de (Postfix) with ESMTPSA id 218E45312DC\r
27         for <notmuch@notmuchmail.org>; Tue, 21 Feb 2012 01:29:27 +0100 (CET)\r
28 Received: by mail.jade-hamburg.de (Postfix, from userid 401)\r
29         id 180BBDF2A4; Tue, 21 Feb 2012 01:29:26 +0100 (CET)\r
30 Received: from thinkbox.jade-hamburg.de\r
31         (dslb-088-075-032-221.pools.arcor-ip.net [88.75.32.221])\r
32         (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
33         (No client certificate requested) (Authenticated sender: teythoon)\r
34         by mail.jade-hamburg.de (Postfix) with ESMTPSA id 46CD7DF2A1\r
35         for <notmuch@notmuchmail.org>; Tue, 21 Feb 2012 01:29:25 +0100 (CET)\r
36 Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77)\r
37         (envelope-from <teythoon@thinkbox.jade-hamburg.de>)\r
38         id 1Rzdbd-0002Sp-Ss\r
39         for notmuch@notmuchmail.org; Tue, 21 Feb 2012 01:29:21 +0100\r
40 Content-Type: text/plain; charset="utf-8"\r
41 MIME-Version: 1.0\r
42 Content-Transfer-Encoding: quoted-printable\r
43 From: Justus Winter <4winter@informatik.uni-hamburg.de>\r
44 User-Agent: alot/0.21+\r
45 To: notmuch mailing list      <notmuch@notmuchmail.org>, \r
46 Date: Tue, 21 Feb 2012 00:29:21 -0000\r
47 Message-ID: <20120221002921.8534.57091@thinkbox.jade-hamburg.de>\r
48 Subject: notmuch as a shared object aka library knigge\r
49 Date: Tue, 21 Feb 2012 01:29:21 +0100\r
50 X-BeenThere: notmuch@notmuchmail.org\r
51 X-Mailman-Version: 2.1.13\r
52 Precedence: list\r
53 List-Id: "Use and development of the notmuch mail system."\r
54         <notmuch.notmuchmail.org>\r
55 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
56         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
57 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
58 List-Post: <mailto:notmuch@notmuchmail.org>\r
59 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
60 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
62 X-List-Received-Date: Tue, 21 Feb 2012 00:29:30 -0000\r
63 \r
64 Hi fellow notmuchrs,\r
65 \r
66 while going through the python bindings I recently came across the\r
67 following note in the documentation for the Database.get_directory\r
68 function [0]:\r
69 \r
70 ~~~ snip ~~~\r
71 Warning\r
72 \r
73 This call needs a writable database in Database.MODE.READ_WRITE\r
74 mode. The underlying library will exit the program if this method is\r
75 used on a read-only database!\r
76 ~~~ snap ~~~\r
77 \r
78 and indeed, the following program exits with an error:\r
79 \r
80 ~~~ snip ~~~\r
81 import os\r
82 import notmuch\r
83 \r
84 db_path =3D os.path.expanduser('~/Maildir')\r
85 \r
86 with notmuch.Database(db_path, mode=3Dnotmuch.Database.MODE.READ_ONLY) as d=\r
87 b:\r
88     db.get_directory('')\r
89 ~~~ snap ~~~\r
90 \r
91 % python temp/get_directory.py\r
92 Internal error: Failure to ensure database is writable (lib/directory.cc:10=\r
93 0).\r
94 \r
95 The line mentioned in the error message reads:\r
96 \r
97     if (notmuch->mode =3D=3D NOTMUCH_DATABASE_MODE_READ_ONLY)\r
98         INTERNAL_ERROR ("Failure to ensure database is writable");\r
99 \r
100 with\r
101 \r
102 /* There's no point in continuing when we've detected that we've done\r
103  * something wrong internally (as opposed to the user passing in a\r
104  * bogus value).\r
105  *\r
106  * Note that __location__ comes from talloc.h.\r
107  */\r
108 #define INTERNAL_ERROR(format, ...)                     \\r
109     _internal_error (format " (%s).\n",                 \\r
110                          ##__VA_ARGS__, __location__)\r
111 \r
112 and _internal_error calling exit(3).\r
113 \r
114 If creating a shared library is the preferred way to increase the\r
115 startup time of the notmuch binary that's totally cool, but if\r
116 libnotmuch is to be used as a library for arbitrary programs it is not\r
117 acceptable to call exit(3).\r
118 \r
119 (And as mentioned before, neither is writing to any file descriptor\r
120 unless it has been specifically requested by the caller.)\r
121 \r
122 Cheers,\r
123 Justus\r
124 \r
125 0: http://notmuch.readthedocs.org/en/latest/index.html#notmuch.Database.get=\r
126 _directory\r