]> git.notmuchmail.org Git - notmuch/commitdiff
lib: fix return value for n_m_reindex
authorDavid Bremner <david@tethera.net>
Thu, 9 Jul 2020 00:17:09 +0000 (21:17 -0300)
committerDavid Bremner <david@tethera.net>
Mon, 20 Jul 2020 11:54:42 +0000 (08:54 -0300)
Also update the documentation for the behaviour of n_m_get_thread_id
that this fix relies on.

lib/message.cc
lib/notmuch.h
test/T560-lib-error.sh

index 09708ed9dcb6d12d7ac888cdde0c5f20d6d8369d..87448101d5e4e8143cc27db520dc8aa612dfedee 100644 (file)
@@ -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) {
     /* 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 */
     }
 
     /* strdup it because the metadata may be invalidated */
index 82d6c10fefc7496c55e56a0541e8305538db20ee..0dd442d46571e0b5d19e01e0c779f72811d1e7da 100644 (file)
@@ -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).
  *
  * 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);
  */
 const char *
 notmuch_message_get_thread_id (notmuch_message_t *message);
index 8543b5dc80445ff0f6a90fe855d2e1b09152a9ff..fda1f1708dc4de54b4ee22bcba63adc3820522ab 100755 (executable)
@@ -662,7 +662,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Handle reindexing message with closed db"
 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;
 cat c_head2 - c_tail <<'EOF' | test_C ${MAIL_DIR}
     {
         notmuch_status_t status;