From 85eb0dcb300db01fb8d6057284c1f55197dc27db Mon Sep 17 00:00:00 2001 From: David Bremner Date: Wed, 30 Mar 2016 23:10:14 +2100 Subject: [PATCH] [PATCH 2/2] cli/new: add better error messages for FILE_ERROR --- 07/9f98a8f4f94cff7aad94ee8a3c87e37ac8c11e | 72 +++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 07/9f98a8f4f94cff7aad94ee8a3c87e37ac8c11e diff --git a/07/9f98a8f4f94cff7aad94ee8a3c87e37ac8c11e b/07/9f98a8f4f94cff7aad94ee8a3c87e37ac8c11e new file mode 100644 index 000000000..728a50fab --- /dev/null +++ b/07/9f98a8f4f94cff7aad94ee8a3c87e37ac8c11e @@ -0,0 +1,72 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id A94176DE02A7 + for ; Tue, 29 Mar 2016 19:10:31 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.021 +X-Spam-Level: +X-Spam-Status: No, score=-0.021 tagged_above=-999 required=5 + tests=[AWL=-0.010, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 5qiEckSYksBG for ; + Tue, 29 Mar 2016 19:10:22 -0700 (PDT) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id B96EA6DE00DF + for ; Tue, 29 Mar 2016 19:10:22 -0700 (PDT) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1al5ay-0000A8-5w; Tue, 29 Mar 2016 22:10:56 -0400 +Received: (nullmailer pid 32051 invoked by uid 1000); + Wed, 30 Mar 2016 02:10:18 -0000 +From: David Bremner +To: notmuch@notmuchmail.org +Subject: [PATCH 2/2] cli/new: add better error messages for FILE_ERROR +Date: Tue, 29 Mar 2016 23:10:14 -0300 +Message-Id: <1459303814-31988-3-git-send-email-david@tethera.net> +X-Mailer: git-send-email 2.8.0.rc3 +In-Reply-To: <1459303814-31988-1-git-send-email-david@tethera.net> +References: <1459303814-31988-1-git-send-email-david@tethera.net> +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Wed, 30 Mar 2016 02:10:31 -0000 + +The code in add_file seems to assume that NOTMUCH_STATUS_FILE_ERROR is +never returned from add_message. This turns out to be false (although it +seems to only happen in certain fairly rare race conditions). +--- + notmuch-new.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/notmuch-new.c b/notmuch-new.c +index e503776..04cb5ca 100644 +--- a/notmuch-new.c ++++ b/notmuch-new.c +@@ -281,6 +281,10 @@ add_file (notmuch_database_t *notmuch, const char *filename, + fprintf (stderr, "Note: Ignoring non-mail file: %s\n", filename); + break; + /* Fatal issues. Don't process anymore. */ ++ case NOTMUCH_STATUS_FILE_ERROR: ++ fprintf (stderr, "Unexpected error with file %s\n", filename); ++ (void) print_status_database ("add_file", notmuch, status); ++ goto DONE; + case NOTMUCH_STATUS_READ_ONLY_DATABASE: + case NOTMUCH_STATUS_XAPIAN_EXCEPTION: + case NOTMUCH_STATUS_OUT_OF_MEMORY: +-- +2.8.0.rc3 + -- 2.26.2