1 Return-Path: <amdragon@mit.edu>
\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 C5B75431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 21 Apr 2012 21:21:09 -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 KOAH1xXFdPbL for <notmuch@notmuchmail.org>;
\r
16 Sat, 21 Apr 2012 21:21:09 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id F06AB431FAE
\r
20 for <notmuch@notmuchmail.org>; Sat, 21 Apr 2012 21:21:08 -0700 (PDT)
\r
21 X-AuditID: 12074422-b7fd66d0000008f9-10-4f938733c3d6
\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])
\r
23 by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id E2.54.02297.337839F4; Sun, 22 Apr 2012 00:21:07 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id q3M4L65m014648;
\r
27 Sun, 22 Apr 2012 00:21:07 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q3M4L5ig010696
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Sun, 22 Apr 2012 00:21:06 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1SLoIL-0005S4-B7; Sun, 22 Apr 2012 00:21:05 -0400
\r
37 Date: Sun, 22 Apr 2012 00:21:05 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: Mark Walters <markwalters1009@gmail.com>
\r
40 Subject: Re: [PATCH 2/3] new: Handle fatal errors in remove_filename and
\r
42 Message-ID: <20120422042105.GB17810@mit.edu>
\r
43 References: <1330357759-1337-1-git-send-email-amdragon@mit.edu>
\r
44 <1330357759-1337-3-git-send-email-amdragon@mit.edu>
\r
45 <87wr5f4qci.fsf@qmul.ac.uk>
\r
47 Content-Type: text/plain; charset=us-ascii
\r
48 Content-Disposition: inline
\r
49 In-Reply-To: <87wr5f4qci.fsf@qmul.ac.uk>
\r
50 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
51 X-Brightmail-Tracker:
\r
52 H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IR4hTV1jVun+xvsHeWlMXquTwW12/OZHZg
\r
53 8tg56y67x7NVt5gDmKK4bFJSczLLUov07RK4Mt5f3MFUMEWx4vSeRsYGxquSXYycHBICJhKr
\r
54 r6xjhLDFJC7cW8/WxcjFISSwj1Fiyul7LBDOBkaJv7duMYNUCQmcZJKYfUMSIrGEUWLa/l6w
\r
55 BIuAqsTU7e/ZQWw2AQ2JbfuXg40VEdCRuH1oAVicWUBa4tvvZiYQW1ggRmJxwwowmxeo5sSp
\r
56 2YwQQycDDW06yQKREJQ4OfMJC0SzlsSNfy+BGjjABi3/xwES5gTatazrH1iJqICKxJST29gm
\r
57 MArNQtI9C0n3LITuBYzMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3RN9XIzS/RSU0o3MYLCmt1F
\r
58 aQfjz4NKhxgFOBiVeHhfmUz2F2JNLCuuzD3EKMnBpCTKq18JFOJLyk+pzEgszogvKs1JLT7E
\r
59 KMHBrCTC+1kEKMebklhZlVqUD5OS5mBREudV13rnJySQnliSmp2aWpBaBJOV4eBQkuBNaANq
\r
60 FCxKTU+tSMvMKUFIM3FwggznARruCFLDW1yQmFucmQ6RP8WoKCXOmw+SEABJZJTmwfXC0s4r
\r
61 RnGgV4R5fUGqeIApC677FdBgJqDBCTGTQAaXJCKkpBoYq1+vXe+X73fY9H7zj1vFCsUt4qIV
\r
62 e26oHt/m/0v62PO6kEl+mWlOuhfcl+w4znSypmgNl55znUzllh8zb9xuurDa4Hvz4sv3JjZl
\r
63 RPafilk3SUdMIlYnYj+Xm2ZBbmjhBLucyP3zvs2VOJzw+0Dv60Mlq5S2MZ9l1zy2/fyHZI7p
\r
64 gevlC1wblFiKMxINtZiLihMBN4SMshYDAAA=
\r
65 Cc: notmuch@notmuchmail.org
\r
66 X-BeenThere: notmuch@notmuchmail.org
\r
67 X-Mailman-Version: 2.1.13
\r
69 List-Id: "Use and development of the notmuch mail system."
\r
70 <notmuch.notmuchmail.org>
\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
74 List-Post: <mailto:notmuch@notmuchmail.org>
\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
77 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
78 X-List-Received-Date: Sun, 22 Apr 2012 04:21:09 -0000
\r
80 Quoth Mark Walters on Apr 16 at 5:02 pm:
\r
81 > On Mon, 27 Feb 2012, Austin Clements <amdragon@MIT.EDU> wrote:
\r
82 > > Previously such errors were simply ignored. Now they cause an
\r
83 > > immediate cleanup and abort.
\r
85 > This one looks fine except for a minor query.
\r
88 > > notmuch-new.c | 24 ++++++++++++++++++------
\r
89 > > 1 files changed, 18 insertions(+), 6 deletions(-)
\r
91 > > diff --git a/notmuch-new.c b/notmuch-new.c
\r
92 > > index bd9786a..0cbd479 100644
\r
93 > > --- a/notmuch-new.c
\r
94 > > +++ b/notmuch-new.c
\r
95 > > @@ -780,8 +780,10 @@ remove_filename (notmuch_database_t *notmuch,
\r
96 > > add_files_state->renamed_messages++;
\r
97 > > if (add_files_state->synchronize_flags == TRUE)
\r
98 > > notmuch_message_maildir_flags_to_tags (message);
\r
100 > > + status = NOTMUCH_STATUS_SUCCESS;
\r
101 > > + } else if (status == NOTMUCH_STATUS_SUCCESS) {
\r
102 > > add_files_state->removed_messages++;
\r
104 > > notmuch_message_destroy (message);
\r
105 > > notmuch_database_end_atomic (notmuch);
\r
107 > > @@ -789,12 +791,13 @@ remove_filename (notmuch_database_t *notmuch,
\r
109 > > /* Recursively remove all filenames from the database referring to
\r
110 > > * 'path' (or to any of its children). */
\r
112 > > +static notmuch_status_t
\r
113 > > _remove_directory (void *ctx,
\r
114 > > notmuch_database_t *notmuch,
\r
115 > > const char *path,
\r
116 > > add_files_state_t *add_files_state)
\r
118 > > + notmuch_status_t status;
\r
119 > > notmuch_directory_t *directory;
\r
120 > > notmuch_filenames_t *files, *subdirs;
\r
121 > > char *absolute;
\r
122 > > @@ -807,8 +810,10 @@ _remove_directory (void *ctx,
\r
124 > > absolute = talloc_asprintf (ctx, "%s/%s", path,
\r
125 > > notmuch_filenames_get (files));
\r
126 > > - remove_filename (notmuch, absolute, add_files_state);
\r
127 > > + status = remove_filename (notmuch, absolute, add_files_state);
\r
128 > > talloc_free (absolute);
\r
130 > > + return status;
\r
133 > > for (subdirs = notmuch_directory_get_child_directories (directory);
\r
134 > > @@ -817,11 +822,14 @@ _remove_directory (void *ctx,
\r
136 > > absolute = talloc_asprintf (ctx, "%s/%s", path,
\r
137 > > notmuch_filenames_get (subdirs));
\r
138 > > - _remove_directory (ctx, notmuch, absolute, add_files_state);
\r
139 > > + status = _remove_directory (ctx, notmuch, absolute, add_files_state);
\r
140 > > talloc_free (absolute);
\r
142 > > + return status;
\r
145 > > notmuch_directory_destroy (directory);
\r
146 > > + return NOTMUCH_STATUS_SUCCESS;
\r
149 > In the two "return status" lines above seem to mean we don't call
\r
150 > notmuch_directory_destroy. Does that matter?
\r
152 Good point. I've fixed this to use the usual goto DONE cleanup idiom.
\r
154 > The other query is not actually about this patch: just something that
\r
155 > came up when reading it. Should notmuch_database_begin_atomic and
\r
156 > notmuch_database_end_atomic always be paired? One of the (existing)
\r
157 > error cases in remove_filename seems to return without calling end.
\r
159 Yes, they should be. I've added a patch to fix that.
\r
166 > > @@ -939,7 +947,9 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
168 > > gettimeofday (&tv_start, NULL);
\r
169 > > for (f = add_files_state.removed_files->head; f && !interrupted; f = f->next) {
\r
170 > > - remove_filename (notmuch, f->filename, &add_files_state);
\r
171 > > + ret = remove_filename (notmuch, f->filename, &add_files_state);
\r
174 > > if (do_print_progress) {
\r
175 > > do_print_progress = 0;
\r
176 > > generic_print_progress ("Cleaned up", "messages",
\r
177 > > @@ -950,7 +960,9 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
179 > > gettimeofday (&tv_start, NULL);
\r
180 > > for (f = add_files_state.removed_directories->head, i = 0; f && !interrupted; f = f->next, i++) {
\r
181 > > - _remove_directory (ctx, notmuch, f->filename, &add_files_state);
\r
182 > > + ret = _remove_directory (ctx, notmuch, f->filename, &add_files_state);
\r
185 > > if (do_print_progress) {
\r
186 > > do_print_progress = 0;
\r
187 > > generic_print_progress ("Cleaned up", "directories",
\r