1 Return-Path: <chris@chris-wilson.co.uk>
\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 E0F4D431FBC
\r
6 for <notmuch@notmuchmail.org>; Fri, 27 Nov 2009 05:50:24 -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 UoCvDuqPxYfp for <notmuch@notmuchmail.org>;
\r
11 Fri, 27 Nov 2009 05:50:24 -0800 (PST)
\r
12 Received: from azsmga101.ch.intel.com (mga07.intel.com [143.182.124.22])
\r
13 by olra.theworths.org (Postfix) with ESMTP id 2D794431FAE
\r
14 for <notmuch@notmuchmail.org>; Fri, 27 Nov 2009 05:50:24 -0800 (PST)
\r
15 Received: from azsmga001.ch.intel.com ([10.2.17.19])
\r
16 by azsmga101.ch.intel.com with ESMTP; 27 Nov 2009 05:50:18 -0800
\r
18 X-IronPort-AV: E=Sophos;i="4.47,301,1257148800"; d="scan'208";a="216298364"
\r
19 Received: from unknown (HELO localhost.localdomain) ([10.255.16.178])
\r
20 by azsmga001.ch.intel.com with ESMTP; 27 Nov 2009 05:50:14 -0800
\r
21 From: Chris Wilson <chris@chris-wilson.co.uk>
\r
22 To: notmuch@notmuchmail.org
\r
23 Date: Fri, 27 Nov 2009 13:50:11 +0000
\r
24 Message-Id: <1259329811-6393-1-git-send-email-chris@chris-wilson.co.uk>
\r
25 X-Mailer: git-send-email 1.6.5.3
\r
26 In-Reply-To: <87einkqeyt.fsf@yoom.home.cworth.org>
\r
27 References: <87einkqeyt.fsf@yoom.home.cworth.org>
\r
28 Subject: [notmuch] [PATCH] notmuch-new: Check for non-fatal errors from
\r
30 X-BeenThere: notmuch@notmuchmail.org
\r
31 X-Mailman-Version: 2.1.12
\r
33 List-Id: "Use and development of the notmuch mail system."
\r
34 <notmuch.notmuchmail.org>
\r
35 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
36 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
37 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
38 List-Post: <mailto:notmuch@notmuchmail.org>
\r
39 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
40 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
41 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
42 X-List-Received-Date: Fri, 27 Nov 2009 13:50:25 -0000
\r
44 Currently we assume that all errors on stat() a dname is fatal (but
\r
45 continue anyway and report the error at the end). However, some errors
\r
46 reported by stat() such as a missing file or insufficient privilege,
\r
47 we can simply ignore and skip the file. For the others, such as a fault
\r
48 (unlikely!) or out-of-memory, we handle like the other fatal errors by
\r
51 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
\r
53 notmuch-new.c | 13 ++++++++++++-
\r
54 1 files changed, 12 insertions(+), 1 deletions(-)
\r
56 diff --git a/notmuch-new.c b/notmuch-new.c
\r
57 index 3cde3a7..71224c5 100644
\r
60 @@ -168,10 +168,21 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
61 next = talloc_asprintf (notmuch, "%s/%s", path, entry->d_name);
\r
63 if (stat (next, st)) {
\r
68 + /* The file was removed between scandir and now... */
\r
71 + /* We can't read this file so don't add it to the cache. */
\r
75 fprintf (stderr, "Error reading %s: %s\n",
\r
76 next, strerror (errno));
\r
77 ret = NOTMUCH_STATUS_FILE_ERROR;
\r
82 if (S_ISREG (st->st_mode)) {
\r