From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 360D3431FBC for ; Tue, 5 Aug 2014 07:33:57 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] 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 oRGZpN2yYPfg for ; Tue, 5 Aug 2014 07:33:52 -0700 (PDT) Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu [18.7.68.34]) by olra.theworths.org (Postfix) with ESMTP id 59C74431FAE for ; Tue, 5 Aug 2014 07:33:52 -0700 (PDT) X-AuditID: 12074422-f79be6d000007518-24-53e0eb4fbc4b Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) (using TLS with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP id C9.62.29976.F4BE0E35; Tue, 5 Aug 2014 10:33:51 -0400 (EDT) Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id s75EXmea012535; Tue, 5 Aug 2014 10:33:49 -0400 Received: from drake.dyndns.org (216-15-114-40.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com [216.15.114.40]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s75EXkWZ028467 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Tue, 5 Aug 2014 10:33:48 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1XEfoA-0003Mj-GT; Tue, 05 Aug 2014 10:33:46 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH v2] new: Report and abort on upgrade failure Date: Tue, 5 Aug 2014 10:33:43 -0400 Message-Id: <1407249223-12827-1-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 2.0.0 In-Reply-To: <87bnrzfau4.fsf@maritornes.cs.unb.ca> References: <87bnrzfau4.fsf@maritornes.cs.unb.ca> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDIsWRmVeSWpSXmKPExsUixCmqrOv/+kGwQVOjqcWN1m5Gi+s3ZzI7 MHk8W3WL2WPLoffMAUxRXDYpqTmZZalF+nYJXBlNfRdYCmYIVKy8eYC5gbGVt4uRk0NCwETi 6Oa17BC2mMSFe+vZQGwhgdlMEh//mXcxcgHZGxglLhx9zASRuM0ksfxbCURiLqPElDtfwLrZ BDQktu1fzghiiwhIS+y8O5sVxGYWsJS4+rUdrFlYwEbiwt7nYBtYBFQl7k7cAxbnFXCQ+PX+ LSPEFXISDTc+gdVwChhJbD+/iQVisaHE6RfTWCYw8i9gZFjFKJuSW6Wbm5iZU5yarFucnJiX l1qka6qXm1mil5pSuokRFEjsLko7GH8eVDrEKMDBqMTDK6B2P1iINbGsuDL3EKMkB5OSKO/S Vw+ChfiS8lMqMxKLM+KLSnNSiw8xSnAwK4nwst8GyvGmJFZWpRblw6SkOViUxHnfWlsFCwmk J5akZqemFqQWwWRlODiUJHijQIYKFqWmp1akZeaUIKSZODhBhvMADZ8LUsNbXJCYW5yZDpE/ xagoJc7b/RIoIQCSyCjNg+uFRforRnGgV4R5l4O08wCTBFz3K6DBTECDzXTugwwuSURISTUw Guk+OLT1ldrBlLf+SxsS1SXydzNtLHd7ECx8r+3knkTLhLu2qx54B0/VYF5Wr+u+iHe/47EC 6YK/Ezs2Ju9eb/vWKDpvkX4Lg/nsN8yXIvU5L2xZUntccqbCr3crclKvvLRu/Z8jxBW5+/D8 eUwLJVdfv1O0Z88ph6VL1P4JfYz3tDnPnCQ5S4mlOCPRUIu5qDgRAK1i64DPAgAA 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: Tue, 05 Aug 2014 14:33:57 -0000 Previously the return status of notmuch_database_upgrade went completely unchecked. --- Quite right. v1 had some context that had been modified by my features branch. Here's the same patch, but with context that should work on master. notmuch-new.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index d269c7c..5691005 100644 --- a/notmuch-new.c +++ b/notmuch-new.c @@ -923,6 +923,7 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) notmuch_bool_t timer_is_active = FALSE; notmuch_bool_t no_hooks = FALSE; notmuch_bool_t quiet = FALSE, verbose = FALSE; + notmuch_status_t status; add_files_state.verbosity = VERBOSITY_NORMAL; add_files_state.debug = FALSE; @@ -1019,9 +1020,16 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) } gettimeofday (&add_files_state.tv_start, NULL); - notmuch_database_upgrade (notmuch, - add_files_state.verbosity >= VERBOSITY_NORMAL ? upgrade_print_progress : NULL, - &add_files_state); + status = notmuch_database_upgrade ( + notmuch, + add_files_state.verbosity >= VERBOSITY_NORMAL ? upgrade_print_progress : NULL, + &add_files_state); + if (status) { + printf ("Upgrade failed: %s\n", + notmuch_status_to_string (status)); + notmuch_database_destroy (notmuch); + return EXIT_FAILURE; + } if (add_files_state.verbosity >= VERBOSITY_NORMAL) printf ("Your notmuch database has now been upgraded to database format version %u.\n", notmuch_database_get_version (notmuch)); @@ -1091,7 +1099,6 @@ notmuch_new_command (notmuch_config_t *config, int argc, char *argv[]) } for (f = add_files_state.directory_mtimes->head; f && !interrupted; f = f->next) { - notmuch_status_t status; notmuch_directory_t *directory; status = notmuch_database_get_directory (notmuch, f->filename, &directory); if (status == NOTMUCH_STATUS_SUCCESS && directory) { -- 2.0.0