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 166DE431FC0 for ; Mon, 4 Aug 2014 18:29:59 -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 TcLH537UmaUV for ; Mon, 4 Aug 2014 18:29:53 -0700 (PDT) Received: from dmz-mailsec-scanner-8.mit.edu (dmz-mailsec-scanner-8.mit.edu [18.7.68.37]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id B883C431FC4 for ; Mon, 4 Aug 2014 18:29:53 -0700 (PDT) X-AuditID: 12074425-f79766d000006da8-55-53e03390c3e8 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-8.mit.edu (Symantec Messaging Gateway) with SMTP id 47.6A.28072.09330E35; Mon, 4 Aug 2014 21:29:52 -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 s751To6X018138; Mon, 4 Aug 2014 21:29:50 -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 s751Tmc7000738 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Mon, 4 Aug 2014 21:29:49 -0400 Received: from amthrax by drake.dyndns.org with local (Exim 4.77) (envelope-from ) id 1XETZU-00012f-Ni; Mon, 04 Aug 2014 21:29:48 -0400 From: Austin Clements To: notmuch@notmuchmail.org Subject: [PATCH] new: Report and abort on upgrade failure Date: Mon, 4 Aug 2014 21:29:46 -0400 Message-Id: <1407202186-3968-1-git-send-email-amdragon@mit.edu> X-Mailer: git-send-email 2.0.0 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprFIsWRmVeSWpSXmKPExsUixCmqrDvB+EGwwemXvBbXb85kdmD0eLbq FnMAYxSXTUpqTmZZapG+XQJXxuOL+9gLNvNVbN56kbmB8Rx3FyMnh4SAicSWX1PYIWwxiQv3 1rN1MXJxCAnMZpKYcnUqC4SzgVHi2YYFrCBVQgK3mST+rNOFSMxllFjz/SojSIJNQENi2/7l YLaIgLTEzruzgRo4OJgF1CT+dKmAhIUFLCX2Ni0Hm8MioCqx+/83MJtXwF7i87mdrBBXyEk0 3PjENoGRdwEjwypG2ZTcKt3cxMyc4tRk3eLkxLy81CJdC73czBK91JTSTYygIGB3Ud3BOOGQ 0iFGAQ5GJR5eAbX7wUKsiWXFlbmHGCU5mJREeUP1HgQL8SXlp1RmJBZnxBeV5qQWH2KU4GBW EuHNFwTK8aYkVlalFuXDpKQ5WJTEed9aWwULCaQnlqRmp6YWpBbBZGU4OJQkeA8bAjUKFqWm p1akZeaUIKSZODhBhvMADT8NUsNbXJCYW5yZDpE/xagoJc7rAZIQAElklObB9cKi9BWjONAr wrwXQKp4gBEO1/0KaDAT0GAznfsgg0sSEVJSDYx72Dbp+Msli3y1Nc/zXLJH4mTxObMU61UW HswR/wVul69IPBSQ0bH2WbTMnrjJM5KSk9T+r3LNva/Cosu7UeSd6J38ZtW/xSef750ltEqT jbVVIC/Y7eah8yEvSn6q6Wy8vd9mfq2T49Mt8buOtjvvOe9w+Vv6g+kKsYWM/ffUeMpc51ft jlJiKc5INNRiLipOBADy0TXSrQIAAA== 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 01:29:59 -0000 Previously the return status of notmuch_database_upgrade went completely unchecked. --- notmuch-new.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index b7590a8..ddf42c1 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.\n"); } @@ -1090,7 +1098,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