Re: [PATCH] Fix typo in Message.maildir_flags_to_tags
[notmuch-archives.git] / 65 / 4339f527bc84310ef3dfd21549c4270cc27991
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 D42E1429E27\r
6         for <notmuch@notmuchmail.org>; Sun,  6 Jan 2013 12:23:54 -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.7\r
10 X-Spam-Level: \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 Dy2fmuIXFRk3 for <notmuch@notmuchmail.org>;\r
16         Sun,  6 Jan 2013 12:23:54 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU\r
18         [18.9.25.13])\r
19         by olra.theworths.org (Postfix) with ESMTP id B6EAD429E40\r
20         for <notmuch@notmuchmail.org>; Sun,  6 Jan 2013 12:23:33 -0800 (PST)\r
21 X-AuditID: 1209190d-b7efd6d000001a82-5c-50e9dd4521fc\r
22 Received: from mailhub-auth-3.mit.edu ( [18.9.21.43])\r
23         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id 58.AA.06786.54DD9E05; Sun,  6 Jan 2013 15:23:33 -0500 (EST)\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 r06KNWu2016514; \r
27         Sun, 6 Jan 2013 15:23:32 -0500\r
28 Received: from drake.dyndns.org (a069.catapulsion.net [70.36.81.69])\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 r06KMq2G020341\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sun, 6 Jan 2013 15:23:30 -0500 (EST)\r
34 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1Trwk6-0007Y8-B2; Sun, 06 Jan 2013 15:22:50 -0500\r
37 From: Austin Clements <amdragon@MIT.EDU>\r
38 To: notmuch@notmuchmail.org\r
39 Subject: [PATCH v5 1/6] restore: Make missing messages non-fatal (again)\r
40 Date: Sun,  6 Jan 2013 15:22:37 -0500\r
41 Message-Id: <1357503762-28759-2-git-send-email-amdragon@mit.edu>\r
42 X-Mailer: git-send-email 1.7.10.4\r
43 In-Reply-To: <1357503762-28759-1-git-send-email-amdragon@mit.edu>\r
44 References: <1357503762-28759-1-git-send-email-amdragon@mit.edu>\r
45 X-Brightmail-Tracker:\r
46  H4sIAAAAAAAAA+NgFrrJIsWRmVeSWpSXmKPExsUixCmqret692WAwZfvQhY3WrsZLZqmO1us\r
47         nstjcf3mTGaLNyvnsTqweuycdZfd4/DXhSwet+6/Zvd4tuoWs8eWQ++ZA1ijuGxSUnMyy1KL\r
48         9O0SuDLWfFnLVHCDv2LP3InMDYybeboYOTkkBEwkDu/oZIGwxSQu3FvP1sXIxSEksI9RYsK9\r
49         j1DOekaJPxsWsoJUCQnsZ5LYfIAXIjGXUeL+jRlsIAk2AQ2JbfuXM4LYIgLSEjvvzmYFKWIW\r
50         aGKUuLZpLliRsICHxJrWj2CTWARUJT6s6gPbzSvgIPFlaRMbxB2KEt3PJgDZHBycAo4SH+fJ\r
51         Qix2kLiz4z77BEb+BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3SN9HIzS/RSU0o3MYJDUJJ3\r
52         B+O7g0qHGAU4GJV4eC/sfBEgxJpYVlyZe4hRkoNJSZT3+J2XAUJ8SfkplRmJxRnxRaU5qcWH\r
53         GCU4mJVEePcdA8rxpiRWVqUW5cOkpDlYlMR5r6Tc9BcSSE8sSc1OTS1ILYLJynBwKEnw3r8N\r
54         1ChYlJqeWpGWmVOCkGbi4AQZzgM0/CVIDW9xQWJucWY6RP4Uo6KUOO8jkIQASCKjNA+uF5Yi\r
55         XjGKA70izPsJpIoHmF7gul8BDWYCGpz6+DnI4JJEhJRUA2OEjU0v29m7EYmXrzXIbNtWeE78\r
56         sw37dOtN0Xe8J+2yXJdWwHtR7/Ljir512SWyE5cvC3uy4JLDvof3F89PUMlV2/pnNqfnr4lT\r
57         9K+/icuRj/6p1xkqP/PRCt7mgoK7EjrPr3wTO/zMO6u7b8lNIbXQ03sf7t7WdnDaixlcF1+v\r
58         +L64/8n8/jMqSizFGYmGWsxFxYkAK5qCwOwCAAA=\r
59 Cc: tomi.ollila@iki.fi\r
60 X-BeenThere: notmuch@notmuchmail.org\r
61 X-Mailman-Version: 2.1.13\r
62 Precedence: list\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: Sun, 06 Jan 2013 20:23:55 -0000\r
73 \r
74 Previously, restore would abort if a message ID in the dump was\r
75 missing.  Furthermore, it would only report this as a warning.  This\r
76 patch makes it distinguish abort-worthy lookup failures like\r
77 out-of-memory from non-fatal failure to find a message ID.  The former\r
78 is reported as an error and causes restore to abort, while the latter\r
79 is reported as a warning and does not cause an abort.\r
80 \r
81 This restores 0.14's non-fatal handling of missing message IDs in\r
82 restore (though 0.14 also considered serious errors non-fatal; we\r
83 retain the new and better handling of serious errors).\r
84 ---\r
85  notmuch-restore.c |   17 +++++++++++------\r
86  1 file changed, 11 insertions(+), 6 deletions(-)\r
87 \r
88 diff --git a/notmuch-restore.c b/notmuch-restore.c\r
89 index 9ed9b51..96834c0 100644\r
90 --- a/notmuch-restore.c\r
91 +++ b/notmuch-restore.c\r
92 @@ -26,7 +26,8 @@\r
93  static regex_t regex;\r
94  \r
95  /* Non-zero return indicates an error in retrieving the message,\r
96 - * or in applying the tags.\r
97 + * or in applying the tags.  Missing messages are reported, but not\r
98 + * considered errors.\r
99   */\r
100  static int\r
101  tag_message (unused (void *ctx),\r
102 @@ -40,13 +41,17 @@ tag_message (unused (void *ctx),\r
103      int ret = 0;\r
104  \r
105      status = notmuch_database_find_message (notmuch, message_id, &message);\r
106 -    if (status || message == NULL) {\r
107 -       fprintf (stderr, "Warning: cannot apply tags to %smessage: %s\n",\r
108 -                message ? "" : "missing ", message_id);\r
109 -       if (status)\r
110 -           fprintf (stderr, "%s\n", notmuch_status_to_string (status));\r
111 +    if (status) {\r
112 +       fprintf (stderr, "Error applying tags to message %s: %s\n",\r
113 +                message_id, notmuch_status_to_string (status));\r
114         return 1;\r
115      }\r
116 +    if (message == NULL) {\r
117 +       fprintf (stderr, "Warning: cannot apply tags to missing message: %s\n",\r
118 +                message_id);\r
119 +       /* We consider this a non-fatal error. */\r
120 +       return 0;\r
121 +    }\r
122  \r
123      /* In order to detect missing messages, this check/optimization is\r
124       * intentionally done *after* first finding the message. */\r
125 -- \r
126 1.7.10.4\r
127 \r