From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oOorEhHPAV/gNwAA0tVLHw (envelope-from ) for ; Sun, 05 Jul 2020 13:01:05 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6CA5DhHPAV+uSAAAB5/wlQ (envelope-from ) for ; Sun, 05 Jul 2020 13:01:05 +0000 Received: from mail.notmuchmail.org (nmbug.tethera.net [IPv6:2607:5300:201:3100::1657]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8C7329406F7 for ; Sun, 5 Jul 2020 13:01:04 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 185C01FC6E; Sun, 5 Jul 2020 09:00:58 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) by mail.notmuchmail.org (Postfix) with ESMTP id BDC031FC3E for ; Sun, 5 Jul 2020 09:00:53 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id B5492613B0; Sun, 5 Jul 2020 09:00:53 -0400 (EDT) Received: (nullmailer pid 4057433 invoked by uid 1000); Sun, 05 Jul 2020 13:00:51 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 10/11] lib: catch Xapian exceptions in n_m_remove_tag Date: Sun, 5 Jul 2020 10:00:25 -0300 Message-Id: <20200705130025.4057292-11-david@tethera.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200705130025.4057292-1-david@tethera.net> References: <20200705130025.4057292-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: W4LVEQW36JS3D7IS2WVH75TKLCWT22M5 X-Message-ID-Hash: W4LVEQW36JS3D7IS2WVH75TKLCWT22M5 X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.1 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 2607:5300:201:3100::1657 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Spam-Score: 1.53 X-TUID: 2ZGCHibdFjAq The churn here is again mainly re-indentation. --- lib/message.cc | 33 +++++++++++++++++++-------------- test/T560-lib-error.sh | 1 - 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 7c9af079..e4463d05 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1648,24 +1648,29 @@ notmuch_message_remove_tag (notmuch_message_t *message, const char *tag) notmuch_private_status_t private_status; notmuch_status_t status; - status = _notmuch_database_ensure_writable (message->notmuch); - if (status) - return status; + try { + status = _notmuch_database_ensure_writable (message->notmuch); + if (status) + return status; - if (tag == NULL) - return NOTMUCH_STATUS_NULL_POINTER; + if (tag == NULL) + return NOTMUCH_STATUS_NULL_POINTER; - if (strlen (tag) > NOTMUCH_TAG_MAX) - return NOTMUCH_STATUS_TAG_TOO_LONG; + if (strlen (tag) > NOTMUCH_TAG_MAX) + return NOTMUCH_STATUS_TAG_TOO_LONG; - private_status = _notmuch_message_remove_term (message, "tag", tag); - if (private_status) { - INTERNAL_ERROR ("_notmuch_message_remove_term return unexpected value: %d\n", - private_status); - } + private_status = _notmuch_message_remove_term (message, "tag", tag); + if (private_status) { + INTERNAL_ERROR ("_notmuch_message_remove_term return unexpected value: %d\n", + private_status); + } - if (! message->frozen) - _notmuch_message_sync (message); + if (! message->frozen) + _notmuch_message_sync (message); + } catch (Xapian::Error &error) { + LOG_XAPIAN_EXCEPTION (message, error); + return NOTMUCH_STATUS_XAPIAN_EXCEPTION; + } return NOTMUCH_STATUS_SUCCESS; } diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index 4640e2c9..afb53346 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -535,7 +535,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "Handle removing tag with closed database" -test_subtest_known_broken cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} { notmuch_status_t status; -- 2.27.0