From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id cFZ/MiVkBl8/QQAA0tVLHw (envelope-from ) for ; Thu, 09 Jul 2020 00:26:13 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id KCROLiVkBl/BawAAbx9fmQ (envelope-from ) for ; Thu, 09 Jul 2020 00:26:13 +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 6FF689400D3 for ; Thu, 9 Jul 2020 00:26:13 +0000 (UTC) Received: from [144.217.243.247] (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 9E4172005F; Wed, 8 Jul 2020 20:25:43 -0400 (EDT) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id 6979D1F70A for ; Wed, 8 Jul 2020 20:25:14 -0400 (EDT) Received: by fethera.tethera.net (Postfix, from userid 1001) id 9C8AB613BE; Wed, 8 Jul 2020 20:17:19 -0400 (EDT) Received: (nullmailer pid 449339 invoked by uid 1000); Thu, 09 Jul 2020 00:17:15 -0000 From: David Bremner To: notmuch@notmuchmail.org Cc: David Bremner Subject: [PATCH 10/10] lib: fix return value for n_m_reindex Date: Wed, 8 Jul 2020 21:17:09 -0300 Message-Id: <20200709001709.449217-11-david@tethera.net> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200709001709.449217-1-david@tethera.net> References: <20200709001709.449217-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: KV6RI7QNW2TDWKBFUAZTYEEEHXQLBR2Q X-Message-ID-Hash: KV6RI7QNW2TDWKBFUAZTYEEEHXQLBR2Q 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: QxJOUtnO0Nja Also update the documentation for the behaviour of n_m_get_thread_id that this fix relies on. --- lib/message.cc | 6 ++++-- lib/notmuch.h | 4 ++-- test/T560-lib-error.sh | 1 - 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/message.cc b/lib/message.cc index 09708ed9..87448101 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -2205,8 +2205,10 @@ notmuch_message_reindex (notmuch_message_t *message, /* Save in case we need to delete message */ orig_thread_id = notmuch_message_get_thread_id (message); if (! orig_thread_id) { - /* XXX TODO: make up new error return? */ - INTERNAL_ERROR ("message without thread-id"); + /* the following is correct as long as there is only one reason + n_m_get_thread_id returns NULL + */ + return NOTMUCH_STATUS_XAPIAN_EXCEPTION; } /* strdup it because the metadata may be invalidated */ diff --git a/lib/notmuch.h b/lib/notmuch.h index 9a19e2f7..97ebc17d 100644 --- a/lib/notmuch.h +++ b/lib/notmuch.h @@ -1378,8 +1378,8 @@ notmuch_message_get_message_id (notmuch_message_t *message); * notmuch_message_destroy on 'message' or until a query from which it * derived is destroyed). * - * This function will not return NULL since Notmuch ensures that every - * message belongs to a single thread. + * This function will return NULL if triggers an unhandled Xapian + * exception. */ const char * notmuch_message_get_thread_id (notmuch_message_t *message); diff --git a/test/T560-lib-error.sh b/test/T560-lib-error.sh index e303720c..536ff701 100755 --- a/test/T560-lib-error.sh +++ b/test/T560-lib-error.sh @@ -679,7 +679,6 @@ EOF test_expect_equal_file EXPECTED OUTPUT test_begin_subtest "Handle reindexing message with closed db" -test_subtest_known_broken cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR} { notmuch_status_t status; -- 2.27.0