Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id D42E1429E27 for ; Sun, 6 Jan 2013 12:23:54 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dy2fmuIXFRk3 for ; Sun, 6 Jan 2013 12:23:54 -0800 (PST) Received: from dmz-mailsec-scanner-2.mit.edu (DMZ-MAILSEC-SCANNER-2.MIT.EDU [18.9.25.13]) by olra.theworths.org (Postfix) with ESMTP id B6EAD429E40 for ; Sun, 6 Jan 2013 12:23:33 -0800 (PST) X-AuditID: 1209190d-b7efd6d000001a82-5c-50e9dd4521fc Received: from mailhub-auth-3.mit.edu ( [18.9.21.43]) by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP id 58.AA.06786.54DD9E05; Sun, 6 Jan 2013 15:23:33 -0500 (EST) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-3.mit.edu (8.13.8/8.9.2) with ESMTP id r06KNWu2016514; Sun, 6 Jan 2013 15:23:32 -0500 Received: from drake.dyndns.org (a069.catapulsion.net [70.36.81.69]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id r06KMq2G020341 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sun, 6 Jan 2013 15:23:30 -0500 (EST) Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1Trwk6-0007Y8-B2; Sun, 06 Jan 2013 15:22:50 -0500 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v5 1/6] restore: Make missing messages non-fatal (again) Date: Sun, 6 Jan 2013 15:22:37 -0500 Message-Id: <1357503762-28759-2-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1357503762-28759-1-git-send-email-amdragon@mit.edu> References: <1357503762-28759-1-git-send-email-amdragon@mit.edu> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJIsWRmVeSWpSXmKPExsUixCmqret692WAwZfvQhY3WrsZLZqmO1us nstjcf3mTGaLNyvnsTqweuycdZfd4/DXhSwet+6/Zvd4tuoWs8eWQ++ZA1ijuGxSUnMyy1KL 9O0SuDLWfFnLVHCDv2LP3InMDYybeboYOTkkBEwkDu/oZIGwxSQu3FvP1sXIxSEksI9RYsK9 j1DOekaJPxsWsoJUCQnsZ5LYfIAXIjGXUeL+jRlsIAk2AQ2JbfuXM4LYIgLSEjvvzmYFKWIW aGKUuLZpLliRsICHxJrWj2CTWARUJT6s6gPbzSvgIPFlaRMbxB2KEt3PJgDZHBycAo4SH+fJ Qix2kLiz4z77BEb+BYwMqxhlU3KrdHMTM3OKU5N1i5MT8/JSi3SN9HIzS/RSU0o3MYJDUJJ3 B+O7g0qHGAU4GJV4eC/sfBEgxJpYVlyZe4hRkoNJSZT3+J2XAUJ8SfkplRmJxRnxRaU5qcWH GCU4mJVEePcdA8rxpiRWVqUW5cOkpDlYlMR5r6Tc9BcSSE8sSc1OTS1ILYLJynBwKEnw3r8N 1ChYlJqeWpGWmVOCkGbi4AQZzgM0/CVIDW9xQWJucWY6RP4Uo6KUOO8jkIQASCKjNA+uF5Yi XjGKA70izPsJpIoHmF7gul8BDWYCGpz6+DnI4JJEhJRUA2OEjU0v29m7EYmXrzXIbNtWeE78 sw37dOtN0Xe8J+2yXJdWwHtR7/Ljir512SWyE5cvC3uy4JLDvof3F89PUMlV2/pnNqfnr4lT 9K+/icuRj/6p1xkqP/PRCt7mgoK7EjrPr3wTO/zMO6u7b8lNIbXQ03sf7t7WdnDaixlcF1+v +L64/8n8/jMqSizFGYmGWsxFxYkAK5qCwOwCAAA= Cc: tomi.ollila@iki.fi X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 06 Jan 2013 20:23:55 -0000 Previously, restore would abort if a message ID in the dump was missing. Furthermore, it would only report this as a warning. This patch makes it distinguish abort-worthy lookup failures like out-of-memory from non-fatal failure to find a message ID. The former is reported as an error and causes restore to abort, while the latter is reported as a warning and does not cause an abort. This restores 0.14's non-fatal handling of missing message IDs in restore (though 0.14 also considered serious errors non-fatal; we retain the new and better handling of serious errors). --- notmuch-restore.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/notmuch-restore.c b/notmuch-restore.c index 9ed9b51..96834c0 100644 --- a/notmuch-restore.c +++ b/notmuch-restore.c @@ -26,7 +26,8 @@ static regex_t regex; /* Non-zero return indicates an error in retrieving the message, - * or in applying the tags. + * or in applying the tags. Missing messages are reported, but not + * considered errors. */ static int tag_message (unused (void *ctx), @@ -40,13 +41,17 @@ tag_message (unused (void *ctx), int ret = 0; status = notmuch_database_find_message (notmuch, message_id, &message); - if (status || message == NULL) { - fprintf (stderr, "Warning: cannot apply tags to %smessage: %s\n", - message ? "" : "missing ", message_id); - if (status) - fprintf (stderr, "%s\n", notmuch_status_to_string (status)); + if (status) { + fprintf (stderr, "Error applying tags to message %s: %s\n", + message_id, notmuch_status_to_string (status)); return 1; } + if (message == NULL) { + fprintf (stderr, "Warning: cannot apply tags to missing message: %s\n", + message_id); + /* We consider this a non-fatal error. */ + return 0; + } /* In order to detect missing messages, this check/optimization is * intentionally done *after* first finding the message. */ -- 1.7.10.4