Re: [PATCH] How to improve the mail handling workflow?
[notmuch-archives.git] / 74 / 92efb12e4645d18278186b87a40c42860be8c0
1 Return-Path: <racin@free.fr>\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 969FF431FBC\r
6         for <notmuch@notmuchmail.org>; Fri, 15 Jan 2010 17:42:51 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.211\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.211 tagged_above=-999 required=5 tests=[AWL=0.210, \r
12         BAYES_50=0.001] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id RDUKrNHscgYI for <notmuch@notmuchmail.org>;\r
16         Fri, 15 Jan 2010 17:42:50 -0800 (PST)\r
17 Received: from smtp5-g21.free.fr (smtp5-g21.free.fr [212.27.42.5])\r
18         by olra.theworths.org (Postfix) with ESMTP id 55424431FAE\r
19         for <notmuch@notmuchmail.org>; Fri, 15 Jan 2010 17:42:48 -0800 (PST)\r
20 Received: from smtp5-g21.free.fr (localhost [127.0.0.1])\r
21         by smtp5-g21.free.fr (Postfix) with ESMTP id 5883DD48052;\r
22         Sat, 16 Jan 2010 02:42:41 +0100 (CET)\r
23 Received: from zimbra1-e1.priv.proxad.net (zimbra1-e1.priv.proxad.net\r
24         [172.20.243.151])\r
25         by smtp5-g21.free.fr (Postfix) with ESMTP id 59D76D48047;\r
26         Sat, 16 Jan 2010 02:42:39 +0100 (CET)\r
27 Date: Sat, 16 Jan 2010 02:42:39 +0100 (CET)\r
28 From: racin@free.fr\r
29 To: Ali Polatel <alip@exherbo.org>\r
30 Message-ID:\r
31  <1728197861.1150741263606159152.JavaMail.root@zimbra1-e1.priv.proxad.net>\r
32 In-Reply-To:\r
33  <1961872606.1150531263605576704.JavaMail.root@zimbra1-e1.priv.proxad.net>\r
34 MIME-Version: 1.0\r
35 Content-Type: multipart/mixed; \r
36         boundary="----=_Part_33818_767327125.1263606159150"\r
37 X-Originating-IP: [82.239.207.166]\r
38 X-Mailer: Zimbra 5.0 (ZimbraWebClient - FF3.0\r
39         (Linux)/5.0.15_GA_2815.UBUNTU8_64)\r
40 X-Authenticated-User: racin@free.fr\r
41 Cc: notmuch@notmuchmail.org\r
42 Subject: Re: [notmuch] Bug with commit\r
43  2e96464f9705be4ec772280cad71a6c9d5831e6f\r
44 X-BeenThere: notmuch@notmuchmail.org\r
45 X-Mailman-Version: 2.1.13\r
46 Precedence: list\r
47 List-Id: "Use and development of the notmuch mail system."\r
48         <notmuch.notmuchmail.org>\r
49 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
50         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
51 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
52 List-Post: <mailto:notmuch@notmuchmail.org>\r
53 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
54 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
55         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
56 X-List-Received-Date: Sat, 16 Jan 2010 01:42:51 -0000\r
57 \r
58 ------=_Part_33818_767327125.1263606159150\r
59 Content-Type: text/plain; charset=utf-8\r
60 Content-Transfer-Encoding: quoted-printable\r
61 \r
62 I still confirm the bug.\r
63 \r
64 The problem is due to relying on non-standardized fields of directory entri=\r
65 es (i.e. d_type), which don't behave the\r
66 same on reiserfs than on ext2 (I use reiserfs).=20\r
67 \r
68 The following ugly patch "solves" my problem.\r
69 \r
70 diff --git a/notmuch-new.c b/notmuch-new.c\r
71 index b740ee2..42d9f89 100644\r
72 --- a/notmuch-new.c\r
73 +++ b/notmuch-new.c\r
74 @@ -359,7 +359,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
75 =20\r
76             if (! S_ISREG (st.st_mode))\r
77                 continue;\r
78 -       } else if (entry->d_type !=3D DT_REG) {\r
79 +       } else if (entry->d_type !=3D DT_REG && entry->d_type !=3D 0) {\r
80             continue;\r
81         }\r
82 \r
83 With this patch, mails are added by the database, but some directories also=\r
84  have d_type set to 0\r
85 and can slip through.\r
86 \r
87 It seems that the only portable way to test for directory types is stat, wh=\r
88 ich is expensive... I don't known\r
89 what's the best way to go.\r
90 \r
91 Matthieu\r
92 \r
93 \r
94 ----- Mail Original -----\r
95 De: "Ali Polatel" <alip@exherbo.org>\r
96 =C3=80: notmuch@notmuchmail.org\r
97 Envoy=C3=A9: Mercredi 13 Janvier 2010 11h21:52 GMT +01:00 Amsterdam / Berli=\r
98 n / Berne / Rome / Stockholm / Vienne\r
99 Objet: Re: [notmuch] Bug with commit 2e96464f9705be4ec772280cad71a6c9d5831e=\r
100 6f\r
101 \r
102 Ali Polatel yazm=C4=B1=C5=9F:\r
103 > racin@free.fr yazm=C4=B1=C5=9F:\r
104 > > Hello,\r
105 > >=20\r
106 > > I just updated notmuch and now notmuch new cannot update my mail anymor=\r
107 e... It tells me that there are\r
108 > > 700 files found, but tells that there's no new mail.\r
109 > >=20\r
110 > > I did a git bisect, which tells me the first bad commit is commit 2e964=\r
111 64f9705be4ec772280cad71a6c9d5831e6f.\r
112 > >=20\r
113 > > I did not try to use the new xapian database or to update xapian; maybe=\r
114  this is the problem.\r
115 > >=20\r
116 > > I tested with several tools to get mail in the maildir format, includin=\r
117 g mb2md and getmail, and I always get the problem.\r
118 > Same problem here, I tried upgrading xapian to xapian-core-1.1.3_svn13824=\r
119 , the problem persists.\r
120 > Here's what happens here:\r
121 > 3074 alip@harikalardiyari> rm -fr .maildir/.notmuch\r
122 > 3075 alip@harikalardiyari> notmuch new\r
123 > Found 210302 total files (that's not much mail).\r
124 > No new mail.\r
125 > 3076 alip@harikalardiyari> notmuch search from:alip@exherbo.org\r
126 > 3077 alip@harikalardiyari>\r
127 >=20\r
128 \r
129 After doing git bisect which gave random results and testing notmuch\r
130 using cworth's notmuch-test script on another file system I figured out\r
131 my problem was due to file system corruption.\r
132 Sorry for the noise...\r
133 \r
134 --=20\r
135 Regards,\r
136 Ali Polatel\r
137 \r
138 _______________________________________________\r
139 notmuch mailing list\r
140 notmuch@notmuchmail.org\r
141 http://notmuchmail.org/mailman/listinfo/notmuch\r
142 \r
143 ------=_Part_33818_767327125.1263606159150\r
144 Content-Type: application/octet-stream; name=patch\r
145 Content-Transfer-Encoding: 7bit\r
146 Content-Disposition: attachment; filename=patch\r
147 \r
148 diff --git a/notmuch-new.c b/notmuch-new.c\r
149 index b740ee2..a972390 100644\r
150 --- a/notmuch-new.c\r
151 +++ b/notmuch-new.c\r
152 @@ -153,7 +153,7 @@ _entries_resemble_maildir (struct dirent **entries, int count)\r
153      int i, found = 0;\r
154  \r
155      for (i = 0; i < count; i++) {\r
156 -       if (entries[i]->d_type != DT_DIR)\r
157 +       if (entries[i]->d_type != DT_DIR || entries[i]->d_type != DT_UNKNOWN)\r
158             continue;\r
159  \r
160         if (strcmp(entries[i]->d_name, "new") == 0 ||\r
161 @@ -273,8 +273,8 @@ add_files_recursive (notmuch_database_t *notmuch,\r
162  \r
163         entry = fs_entries[i];\r
164  \r
165 -       if (entry->d_type != DT_DIR && entry->d_type != DT_LNK)\r
166 -           continue;\r
167 +       if (entry->d_type != DT_DIR && entry->d_type != DT_LNK && entry->d_type != DT_UNKNOWN)\r
168 +         continue;\r
169  \r
170         /* Ignore special directories to avoid infinite recursion.\r
171          * Also ignore the .notmuch directory and any "tmp" directory\r
172 @@ -359,7 +359,7 @@ add_files_recursive (notmuch_database_t *notmuch,\r
173  \r
174             if (! S_ISREG (st.st_mode))\r
175                 continue;\r
176 -       } else if (entry->d_type != DT_REG) {\r
177 +       } else if (entry->d_type != DT_REG && entry->d_type != 0) {\r
178             continue;\r
179         }\r
180  \r
181 \r
182 ------=_Part_33818_767327125.1263606159150--\r