Re: Failing test cases
[notmuch-archives.git] / e4 / 59346b235e6882a138d359409e5bf2a345f879
1 Return-Path: <cworth@cworth.org>\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 53EF74196F2\r
6         for <notmuch@notmuchmail.org>; Tue,  4 May 2010 12:09:58 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -2.89\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-2.89 tagged_above=-999 required=5\r
12         tests=[ALL_TRUSTED=-1, BAYES_00=-1.9, T_MIME_NO_TEXT=0.01]\r
13         autolearn=ham\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 RPqWUhgByAm5; Tue,  4 May 2010 12:09:57 -0700 (PDT)\r
17 Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
18         by olra.theworths.org (Postfix) with ESMTP id 66BCF431FC1;\r
19         Tue,  4 May 2010 12:09:57 -0700 (PDT)\r
20 Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
21         id 0D92B568E09; Tue,  4 May 2010 12:09:57 -0700 (PDT)\r
22 From: Carl Worth <cworth@cworth.org>\r
23 To: Olly Betts <olly@survex.com>, notmuch@notmuchmail.org\r
24 Subject: Re: Failing test cases\r
25 In-Reply-To: <87zl0fmst4.fsf@yoom.home.cworth.org>\r
26 References: <20100425001743.GA9293@jdc.jasonjgw.net>\r
27         <20100428002615.GA10022@jdc.jasonjgw.net>\r
28         <87wrvsqti6.fsf@yoom.home.cworth.org>\r
29         <20100428012547.GA680@jdc.jasonjgw.net>\r
30         <slrnhtkc84.pf1.olly@msgid.survex.com>\r
31         <87zl0fmst4.fsf@yoom.home.cworth.org>\r
32 User-Agent: Notmuch/0.3-7-g2baa576 (http://notmuchmail.org) Emacs/23.1.1\r
33         (i486-pc-linux-gnu)\r
34 Date: Tue, 04 May 2010 12:09:56 -0700\r
35 Message-ID: <87wrvjmqkb.fsf@yoom.home.cworth.org>\r
36 MIME-Version: 1.0\r
37 Content-Type: multipart/signed; boundary="=-=-=";\r
38         micalg=pgp-sha1; protocol="application/pgp-signature"\r
39 X-BeenThere: notmuch@notmuchmail.org\r
40 X-Mailman-Version: 2.1.13\r
41 Precedence: list\r
42 List-Id: "Use and development of the notmuch mail system."\r
43         <notmuch.notmuchmail.org>\r
44 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
45         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
46 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
47 List-Post: <mailto:notmuch@notmuchmail.org>\r
48 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
49 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
51 X-List-Received-Date: Tue, 04 May 2010 19:09:58 -0000\r
52 \r
53 --=-=-=\r
54 Content-Transfer-Encoding: quoted-printable\r
55 \r
56 On Tue, 04 May 2010 11:21:27 -0700, Carl Worth <cworth@cworth.org> wrote:\r
57 > I installed Xapian 1.0.20 (from the libxapian-dev package in sid) and am\r
58 > now getting this failure.\r
59 >=20\r
60 > I'm investigating more closely now, but I thought I'd at least share\r
61 > that much information.\r
62 \r
63 Here are my conclusions based on some additional investigation:\r
64 \r
65 What's happening here is that notmuch is creating a Xapian TermIterator,\r
66 iterating over some of the results, and then modifying the database such\r
67 that the terms being iterated over are affected. Specifically, in this\r
68 test case, notmuch is inserting a new term before the term being pointed\r
69 at by the iterator.\r
70 \r
71 With Xapian 1.0.18 incrementing the iterator from this state causes it\r
72 to point to the next term. However, with Xapian 1.0.20 this same\r
73 increment causes the iterator to point at the same term again.\r
74 \r
75 I was able to put a little workaround into notmuch-new.c that avoids the\r
76 bug (see below). But this isn't entirely satisfactory for several\r
77 reasons:\r
78 \r
79 1. We need to know what the intended semantics of the Xapian iterators\r
80    really are. If this behavior is just a bug in Xapian, then that\r
81    should be fixed.\r
82 \r
83    But if the iterators are to have explicitly undefined behavior in\r
84    cases like this, then notmuch is going to need to carefully copy\r
85    contents out of Xapian iterators when creating notmuch iterators (at\r
86    some performance cost).\r
87 \r
88 2. Working around the bug in notmuch-new.c doesn't fix the notmuch\r
89    library itself, (so that python bindings, etc. will remain\r
90    broken). So we really do need a lower-level fix for this.\r
91 \r
92 To properly do the lower-level fix for (2), we'll need to know the\r
93 answer to (1). Olly, do you have an answer on the intended semantics of\r
94 Xapian iterators?\r
95 \r
96 =2DCarl\r
97 \r
98 diff --git a/notmuch-new.c b/notmuch-new.c\r
99 index 8818728..928bb94 100644\r
100 =2D-- a/notmuch-new.c\r
101 +++ b/notmuch-new.c\r
102 @@ -380,7 +380,11 @@ add_files_recursive (notmuch_database_t *notmuch,\r
103         if (notmuch_filenames_valid (db_files) &&\r
104             strcmp (notmuch_filenames_get (db_files), entry->d_name) =3D=3D 0)\r
105         {\r
106 =2D         notmuch_filenames_move_to_next (db_files);\r
107 +           while (notmuch_filenames_valid (db_files) &&\r
108 +                  strcmp (notmuch_filenames_get (db_files), entry->d_name) <=3D 0)\r
109 +           {\r
110 +               notmuch_filenames_move_to_next (db_files);\r
111 +           }\r
112             continue;\r
113         }\r
114 =20\r
115 \r
116 \r
117 =2D-=20\r
118 carl.d.worth@intel.com\r
119 \r
120 --=-=-=\r
121 Content-Type: application/pgp-signature\r
122 \r
123 -----BEGIN PGP SIGNATURE-----\r
124 Version: GnuPG v1.4.10 (GNU/Linux)\r
125 \r
126 iD8DBQFL4HEE6JDdNq8qSWgRAnlcAJ9XL4VqTAbkPVzX8xTDGM3G2X0ZeQCffdux\r
127 m3fmvhDiXuJHbO7lUKue1mw=\r
128 =X3CT\r
129 -----END PGP SIGNATURE-----\r
130 --=-=-=--\r