1 Return-Path: <jani@nikula.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 3B9A1431FCF
\r
6 for <notmuch@notmuchmail.org>; Thu, 24 May 2012 13:57:22 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\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 ejjTXKX1pPOU for <notmuch@notmuchmail.org>;
\r
16 Thu, 24 May 2012 13:57:21 -0700 (PDT)
\r
17 Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com
\r
18 [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))
\r
19 (No client certificate requested)
\r
20 by olra.theworths.org (Postfix) with ESMTPS id 78064431FBD
\r
21 for <notmuch@notmuchmail.org>; Thu, 24 May 2012 13:57:21 -0700 (PDT)
\r
22 Received: by lbbgk8 with SMTP id gk8so179779lbb.26
\r
23 for <notmuch@notmuchmail.org>; Thu, 24 May 2012 13:57:19 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=google.com; s=20120113;
\r
26 h=from:to:subject:in-reply-to:references:user-agent:date:message-id
\r
27 :mime-version:content-type:x-gm-message-state;
\r
28 bh=coa1rnBnz553nybF0VZC4Z++LLTJzrA4mctnfpAOhvY=;
\r
29 b=iP5g75GceqWRRE65gVmtwZyhc+rGzM0w5F/gh/r0rNPLlOe8fR82Lntrzl/K9VVIxx
\r
30 gitSe1tQr1zvbyr/P3mUYX6qPvWEQ85gvufkIwLLgC46RDbK8zCl3yZHfSarTGYLW0HG
\r
31 lZpR08dvSN6hWaXgrMIwC23RIIbFwaGfMMNks2/n7L4zJ2FBBNaXBxxwTFkFiPIs6ucN
\r
32 R1PeVzTeKIZxK3ALugpxeW8rVU+gTkDQwFLcpv/L5mAnaVG1jx0g0nhzpK4ItWAwjhA/
\r
33 kK2mAlwj5+sLXMWDnYjTd0vBVJF6OUAkje+3L7JIdfIswoJujtUI8LHC1OPCReyrG0DG
\r
35 Received: by 10.112.99.98 with SMTP id ep2mr404637lbb.45.1337893039587;
\r
36 Thu, 24 May 2012 13:57:19 -0700 (PDT)
\r
37 Received: from localhost (dsl-hkibrasgw4-fe50dc00-68.dhcp.inet.fi.
\r
39 by mx.google.com with ESMTPS id fd1sm1879774lbb.7.2012.05.24.13.57.17
\r
40 (version=SSLv3 cipher=OTHER); Thu, 24 May 2012 13:57:18 -0700 (PDT)
\r
41 From: Jani Nikula <jani@nikula.org>
\r
42 To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org
\r
43 Subject: Re: [PATCH v3 3/4] new: Merge error checks from add_files and
\r
45 In-Reply-To: <1337887922-13163-4-git-send-email-amdragon@mit.edu>
\r
46 References: <1336429240-1114-1-git-send-email-amdragon@mit.edu>
\r
47 <1337887922-13163-1-git-send-email-amdragon@mit.edu>
\r
48 <1337887922-13163-4-git-send-email-amdragon@mit.edu>
\r
49 User-Agent: Notmuch/0.13+13~gc259b9a (http://notmuchmail.org) Emacs/23.3.1
\r
51 Date: Thu, 24 May 2012 23:57:16 +0300
\r
52 Message-ID: <87wr415mc3.fsf@nikula.org>
\r
54 Content-Type: text/plain; charset=us-ascii
\r
56 ALoCoQmMf+pGKz66oBofHHM2arg6LZTf7eT8hL6ybHQhY+4v0CJUQGKVaNhOhQhOtf6io8XtID1+
\r
57 X-BeenThere: notmuch@notmuchmail.org
\r
58 X-Mailman-Version: 2.1.13
\r
60 List-Id: "Use and development of the notmuch mail system."
\r
61 <notmuch.notmuchmail.org>
\r
62 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
63 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
64 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
65 List-Post: <mailto:notmuch@notmuchmail.org>
\r
66 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
67 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
68 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
69 X-List-Received-Date: Thu, 24 May 2012 20:57:22 -0000
\r
71 On Thu, 24 May 2012, Austin Clements <amdragon@MIT.EDU> wrote:
\r
72 > Before XXX, add_files_recursive could have been called on a symlink to
\r
73 > a non-directory. Hence, calling it on a non-directory was not an
\r
74 > error, so a separate function, add_files, existed to fail loudly in
\r
75 > situations where the path had to be a directory.
\r
79 Otherwise, this 3/4 and following 4/4 patch LGTM. I didn't bother
\r
80 looking at 1/4 and 2/4 again, as you say there were no changes.
\r
88 > With the new stat-ing logic, add_files_recursive is always called on
\r
89 > directories, so the separation of this logic is no longer necessary.
\r
90 > Hence, this patch moves the strict error checking previously done by
\r
91 > add_files into add_files_recursive.
\r
93 > notmuch-new.c | 27 +++++----------------------
\r
94 > 1 file changed, 5 insertions(+), 22 deletions(-)
\r
96 > diff --git a/notmuch-new.c b/notmuch-new.c
\r
97 > index c64f1a7..2b05605 100644
\r
98 > --- a/notmuch-new.c
\r
99 > +++ b/notmuch-new.c
\r
100 > @@ -308,11 +308,10 @@ add_files_recursive (notmuch_database_t *notmuch,
\r
102 > stat_time = time (NULL);
\r
104 > - /* This is not an error since we may have recursed based on a
\r
105 > - * symlink to a regular file, not a directory, and we don't know
\r
106 > - * that until this stat. */
\r
107 > - if (! S_ISDIR (st.st_mode))
\r
108 > - return NOTMUCH_STATUS_SUCCESS;
\r
109 > + if (! S_ISDIR (st.st_mode)) {
\r
110 > + fprintf (stderr, "Error: %s is not a directory.\n", path);
\r
111 > + return NOTMUCH_STATUS_FILE_ERROR;
\r
114 > fs_mtime = st.st_mtime;
\r
116 > @@ -655,23 +654,7 @@ add_files (notmuch_database_t *notmuch,
\r
117 > const char *path,
\r
118 > add_files_state_t *state)
\r
120 > - notmuch_status_t status;
\r
121 > - struct stat st;
\r
123 > - if (stat (path, &st)) {
\r
124 > - fprintf (stderr, "Error reading directory %s: %s\n",
\r
125 > - path, strerror (errno));
\r
126 > - return NOTMUCH_STATUS_FILE_ERROR;
\r
129 > - if (! S_ISDIR (st.st_mode)) {
\r
130 > - fprintf (stderr, "Error: %s is not a directory.\n", path);
\r
131 > - return NOTMUCH_STATUS_FILE_ERROR;
\r
134 > - status = add_files_recursive (notmuch, path, state);
\r
137 > + return add_files_recursive (notmuch, path, state);
\r
140 > /* XXX: This should be merged with the add_files function since it
\r
144 > _______________________________________________
\r
145 > notmuch mailing list
\r
146 > notmuch@notmuchmail.org
\r
147 > http://notmuchmail.org/mailman/listinfo/notmuch
\r