Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / f1 / 997c3b3ed9e1876cdccb1b50da36cab82fa66f
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 ACE96431FC0;\r
6         Sat, 28 Nov 2009 10:16:12 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id lpDPbnIF+3xu; Sat, 28 Nov 2009 10:16:12 -0800 (PST)\r
11 Received: from cworth.org (localhost [127.0.0.1])\r
12         by olra.theworths.org (Postfix) with ESMTP id 0BF30431FAE;\r
13         Sat, 28 Nov 2009 10:16:11 -0800 (PST)\r
14 From: Carl Worth <cworth@cworth.org>\r
15 To: David Bremner <bremner@pivot.cs.unb.ca>, notmuch@notmuchmail.org\r
16 In-Reply-To: <87k4xbkmwy.wl%bremner@pivot.cs.unb.ca>\r
17 References: <87k4xbkmwy.wl%bremner@pivot.cs.unb.ca>\r
18 Date: Sat, 28 Nov 2009 10:15:57 -0800\r
19 Message-ID: <87tyweplb6.fsf@yoom.home.cworth.org>\r
20 MIME-Version: 1.0\r
21 Content-Type: multipart/signed; boundary="=-=-=";\r
22         micalg=pgp-sha1; protocol="application/pgp-signature"\r
23 Subject: Re: [notmuch] Duplicate In-reply-to line 326 lib/message.cc\r
24 X-BeenThere: notmuch@notmuchmail.org\r
25 X-Mailman-Version: 2.1.12\r
26 Precedence: list\r
27 List-Id: "Use and development of the notmuch mail system."\r
28         <notmuch.notmuchmail.org>\r
29 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
30         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
31 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
32 List-Post: <mailto:notmuch@notmuchmail.org>\r
33 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
34 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
35         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
36 X-List-Received-Date: Sat, 28 Nov 2009 18:16:12 -0000\r
37 \r
38 --=-=-=\r
39 Content-Transfer-Encoding: quoted-printable\r
40 \r
41 On Sat, 28 Nov 2009 05:40:13 -0400, David Bremner <bremner@pivot.cs.unb.ca>=\r
42  wrote:\r
43 > Now it seems that any search that is non-empty (i.e. matches\r
44 > something) crashes with a duplicate In-Reply-To ID. This is in git\r
45 > revision 92c4dcc (although it was the same yesterday).  The oddest\r
46 > thing is that the second message-id is a common English word.\r
47 ...\r
48 > Internal error: Message 877htzhn9e.wl%jemarch@gnu.org has duplicate In-Re=\r
49 ply-To IDs: 1e5bcefd0911081424p12eb6fa9te57ff4cfeb83fcdd@mail.gmail.com and=\r
50  data\r
51 >  (lib/message.cc:326).\r
52 \r
53 Thanks David,\r
54 \r
55 I replicated this without any difficulty. And the fix was to just\r
56 correct a stupid mistake on my part. The only reason I hadn't noticed\r
57 this myself earlier is that I've been doing debug builds with:\r
58 \r
59         make CFLAGS=3D"-g -DDEBUG"\r
60 \r
61 instead of:\r
62 \r
63         make CFLAGS=3D"-g -DDEBUG" CXXFLAGS=3D"-g -DDEBUG"\r
64 \r
65 If we can, I'd like to see about making the former work, to avoid hiding\r
66 things like this in the future.\r
67 \r
68 > At the moment I don't have any real good ideas for how to debug this\r
69 > (or any real familiarity with notmuch internals).  I put a test corpus\r
70 > of messages (all from public mailing lists) at\r
71 \r
72 Before I realized how easy the bug was to replicate and fix, I was going\r
73 to give a couple of debugging ideas here. I guess I'll briefly mention\r
74 things anyway.\r
75 \r
76 The core of what we store in the database for each message is a single\r
77 list of "terms", (each a string of text). We use different terms for\r
78 different purposes by prefixing some with particular sub-strings. See\r
79 the large comment at the top of lib/database.cc for some details on\r
80 this.\r
81 \r
82 So if there *were* an actual case of a duplicate In-Reply-To term here,\r
83 the first thing to do would be to inspect the actual terms in the\r
84 database for the document of the message of interest. Up until now, what\r
85 I've been using for this is a little utility I wrote called\r
86 xapian-dump. It exists deep in the code history of notmuch. So one could\r
87 use git log to find the commit that removed it and then check out the\r
88 commit before that to get the utility.\r
89 \r
90 But xapian-dump is pretty dumb and all it does is dump all terms from\r
91 all documents in the database, (it also dumps all the data and values\r
92 From=20those documents, but we're not talking about those parts\r
93 here). So that's a *lot* of output. More interesting would be a tool to\r
94 dump just the terms from the message you're wanting to debug. So that's\r
95 why I want to introduce a new "notmuch search --for=3Dterms" or so to have\r
96 a much more useful debugging tool.\r
97 \r
98 Anyway, I hope that was informative.\r
99 \r
100 Thanks for reporting the bug!\r
101 \r
102 =2DCarl\r
103 \r
104 commit 64c8d6227a90ea6c37ea112ee20b14f16b9b46e7\r
105 Author: Carl Worth <cworth@cworth.org>\r
106 Date:   Sat Nov 28 10:01:22 2009 -0800\r
107 \r
108     Avoid bogus internal error reporting duplicate In-Reply-To IDs.\r
109 =20=20=20=20\r
110     This error was tirggered with a debugging build via:\r
111 =20=20=20=20\r
112         make CXXFLAGS=3D"-DDEBUG"\r
113 =20=20=20=20\r
114     and reported by David Bremner. The actual error is that I'm an\r
115     idiot that doesn't know how to use strcmp's return value. Of\r
116     course, the strcmp interface scores a negative 7 on Rusty Russell\r
117     ranking of bad interfaces:\r
118 =20=20=20=20\r
119     http://ozlabs.org/~rusty/index.cgi/tech/2008-04-01.html\r
120 \r
121 diff --git a/lib/message.cc b/lib/message.cc\r
122 index 03b8c81..49519f1 100644\r
123 =2D-- a/lib/message.cc\r
124 +++ b/lib/message.cc\r
125 @@ -318,7 +318,7 @@ _notmuch_message_get_in_reply_to (notmuch_message_t *me=\r
126 ssage\r
127      in_reply_to =3D *i;\r
128 =20\r
129      if (i !=3D message->doc.termlist_end () &&\r
130 =2D       strncmp ((*i).c_str (), prefix, prefix_len))\r
131 +       strncmp ((*i).c_str (), prefix, prefix_len) =3D=3D 0)\r
132      {\r
133         INTERNAL_ERROR ("Message %s has duplicate In-Reply-To IDs: %s and %=\r
134 s\n",\r
135                         notmuch_message_get_message_id (message),\r
136 \r
137 --=-=-=\r
138 Content-Type: application/pgp-signature\r
139 \r
140 -----BEGIN PGP SIGNATURE-----\r
141 Version: GnuPG v1.4.10 (GNU/Linux)\r
142 \r
143 iD8DBQFLEWjd6JDdNq8qSWgRAqooAJsF9ViBdIGGYFWIqOfWHd1jzMjbyACePfHB\r
144 zRIow85fDP3m4cK2PTUm+88=\r
145 =1j5B\r
146 -----END PGP SIGNATURE-----\r
147 --=-=-=--\r