1 Return-Path: <amthrax@drake.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 90340431FAF
\r
6 for <notmuch@notmuchmail.org>; Mon, 27 Feb 2012 07:49:29 -0800 (PST)
\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 fKDS3jicJpKm for <notmuch@notmuchmail.org>;
\r
16 Mon, 27 Feb 2012 07:49:28 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-1.mit.edu (DMZ-MAILSEC-SCANNER-1.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 98E1C431FAE
\r
20 for <notmuch@notmuchmail.org>; Mon, 27 Feb 2012 07:49:28 -0800 (PST)
\r
21 X-AuditID: 1209190c-b7fad6d000000920-f7-4f4ba6082378
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 71.13.02336.806AB4F4; Mon, 27 Feb 2012 10:49:28 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q1RFnRDf000950;
\r
27 Mon, 27 Feb 2012 10:49:27 -0500
\r
28 Received: from drake.mit.edu
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q1RFnQaN003394
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Mon, 27 Feb 2012 10:49:27 -0500 (EST)
\r
35 Received: from amthrax by drake.mit.edu with local (Exim 4.77)
\r
36 (envelope-from <amthrax@drake.mit.edu>)
\r
37 id 1S22pK-0000N9-9u; Mon, 27 Feb 2012 10:49:26 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH 2/3] new: Handle fatal errors in remove_filename and
\r
42 Date: Mon, 27 Feb 2012 10:49:18 -0500
\r
43 Message-Id: <1330357759-1337-3-git-send-email-amdragon@mit.edu>
\r
44 X-Mailer: git-send-email 1.7.7.3
\r
45 In-Reply-To: <1330357759-1337-1-git-send-email-amdragon@mit.edu>
\r
46 References: <1330357759-1337-1-git-send-email-amdragon@mit.edu>
\r
47 X-Brightmail-Tracker:
\r
48 H4sIAAAAAAAAA+NgFtrEIsWRmVeSWpSXmKPExsUixG6nosuxzNvf4MpWCYvrN2cyOzB6PFt1
\r
49 izmAMYrLJiU1J7MstUjfLoEro2P9KsaC9xIV7/d3MDYwvhfuYuTkkBAwkVjxah8LhC0mceHe
\r
50 ejYQW0hgH6PEwV86XYxcQPYGRok/E84wQjj3mSTWvV4L5cxnlFh08jwzSAubgIbEtv3LGUFs
\r
51 EQFpiZ13Z7N2MXJwMAuoSfzpUgEJCwuESWzrvcAEYrMIqEq8fPuTFcTmFbCXOHR+JzPEFQoS
\r
52 51afYwexOQUcJF6u+Qt1kb3EonNnmCcw8i9gZFjFKJuSW6Wbm5iZU5yarFucnJiXl1qka6iX
\r
53 m1mil5pSuokRFDSckjw7GN8cVDrEKMDBqMTDWzTL21+INbGsuDL3EKMkB5OSKK/nEqAQX1J+
\r
54 SmVGYnFGfFFpTmrxIUYJDmYlEV79bKAcb0piZVVqUT5MSpqDRUmcV0XrnZ+QQHpiSWp2ampB
\r
55 ahFMVoaDQ0mCV2ApUKNgUWp6akVaZk4JQpqJgxNkOA/QcFOQGt7igsTc4sx0iPwpRkUpcV52
\r
56 kIQASCKjNA+uFxbVrxjFgV4R5rUEqeIBJgS47ldAg5mABgdwgg0uSURISTUwcvW+Uf/dbzB5
\r
57 x6oP2rM4Py960+u1UPvTy/8WE74IiXzc8f/suugrl99E3F68ac10sxkr5KN//z/JrXZo5/oC
\r
58 dtcIj3qVyX65+r3c772qBF/9O1L5tuvRpwPSU+snCFt++Hs6f7GcNPsKXwb5z5cXlCd+DT5t
\r
59 eoDdJ/9y856N8xazH/z4QuBo9golluKMREMt5qLiRAD7Oz7jxQIAAA==
\r
60 X-BeenThere: notmuch@notmuchmail.org
\r
61 X-Mailman-Version: 2.1.13
\r
63 List-Id: "Use and development of the notmuch mail system."
\r
64 <notmuch.notmuchmail.org>
\r
65 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
66 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
67 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
68 List-Post: <mailto:notmuch@notmuchmail.org>
\r
69 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
70 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
71 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
72 X-List-Received-Date: Mon, 27 Feb 2012 15:49:29 -0000
\r
74 Previously such errors were simply ignored. Now they cause an
\r
75 immediate cleanup and abort.
\r
77 notmuch-new.c | 24 ++++++++++++++++++------
\r
78 1 files changed, 18 insertions(+), 6 deletions(-)
\r
80 diff --git a/notmuch-new.c b/notmuch-new.c
\r
81 index bd9786a..0cbd479 100644
\r
84 @@ -780,8 +780,10 @@ remove_filename (notmuch_database_t *notmuch,
\r
85 add_files_state->renamed_messages++;
\r
86 if (add_files_state->synchronize_flags == TRUE)
\r
87 notmuch_message_maildir_flags_to_tags (message);
\r
89 + status = NOTMUCH_STATUS_SUCCESS;
\r
90 + } else if (status == NOTMUCH_STATUS_SUCCESS) {
\r
91 add_files_state->removed_messages++;
\r
93 notmuch_message_destroy (message);
\r
94 notmuch_database_end_atomic (notmuch);
\r
96 @@ -789,12 +791,13 @@ remove_filename (notmuch_database_t *notmuch,
\r
98 /* Recursively remove all filenames from the database referring to
\r
99 * 'path' (or to any of its children). */
\r
101 +static notmuch_status_t
\r
102 _remove_directory (void *ctx,
\r
103 notmuch_database_t *notmuch,
\r
105 add_files_state_t *add_files_state)
\r
107 + notmuch_status_t status;
\r
108 notmuch_directory_t *directory;
\r
109 notmuch_filenames_t *files, *subdirs;
\r
111 @@ -807,8 +810,10 @@ _remove_directory (void *ctx,
\r
113 absolute = talloc_asprintf (ctx, "%s/%s", path,
\r
114 notmuch_filenames_get (files));
\r
115 - remove_filename (notmuch, absolute, add_files_state);
\r
116 + status = remove_filename (notmuch, absolute, add_files_state);
\r
117 talloc_free (absolute);
\r
122 for (subdirs = notmuch_directory_get_child_directories (directory);
\r
123 @@ -817,11 +822,14 @@ _remove_directory (void *ctx,
\r
125 absolute = talloc_asprintf (ctx, "%s/%s", path,
\r
126 notmuch_filenames_get (subdirs));
\r
127 - _remove_directory (ctx, notmuch, absolute, add_files_state);
\r
128 + status = _remove_directory (ctx, notmuch, absolute, add_files_state);
\r
129 talloc_free (absolute);
\r
134 notmuch_directory_destroy (directory);
\r
135 + return NOTMUCH_STATUS_SUCCESS;
\r
139 @@ -939,7 +947,9 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
141 gettimeofday (&tv_start, NULL);
\r
142 for (f = add_files_state.removed_files->head; f && !interrupted; f = f->next) {
\r
143 - remove_filename (notmuch, f->filename, &add_files_state);
\r
144 + ret = remove_filename (notmuch, f->filename, &add_files_state);
\r
147 if (do_print_progress) {
\r
148 do_print_progress = 0;
\r
149 generic_print_progress ("Cleaned up", "messages",
\r
150 @@ -950,7 +960,9 @@ notmuch_new_command (void *ctx, int argc, char *argv[])
\r
152 gettimeofday (&tv_start, NULL);
\r
153 for (f = add_files_state.removed_directories->head, i = 0; f && !interrupted; f = f->next, i++) {
\r
154 - _remove_directory (ctx, notmuch, f->filename, &add_files_state);
\r
155 + ret = _remove_directory (ctx, notmuch, f->filename, &add_files_state);
\r
158 if (do_print_progress) {
\r
159 do_print_progress = 0;
\r
160 generic_print_progress ("Cleaned up", "directories",
\r