add status value to _notmuch_message_ensure_metadata

Gaute Hope eg at gaute.vetsj.com
Mon Feb 20 01:27:09 PST 2017


David Bremner writes on februar 18, 2017 15:45:
> In id:1487339566.mz8acpov1j.astroid at strange.none , Gaute provided a
> traceback of an uncaught Xapian::DatabaseModifiedError. The fix for
> this is simple, but somewhat intrusive.
>
> [...]
>
> I haven't tested against Gaute's test case (needs more boost than I
> have handy).

Hi, thanks this seems to get rid of the hard crash, the output from my test
case is attached below.

I have not yet tried to use any new status returns, it seems that the
immediate result is that `notmuch_threads_get ()` returns a valid (but
empty?) notmuch_thread_t * which results in
`notmuch_thread_get_thread_id ()` returning NULL. Strangely, at some
seemingly arbitrary intervals the methods seem to work correctly and
return a valid `notmuch_thread_t` struct. 

`threads` and `thread` remain not NULL.


```
$ test/test_notmuch_standalone
db: running test query..
query: *, approx: 10 threads.
thread id to change: 0000000000000002, thread no: 3
restarting query..
moving to thread: 2
tags: inbox unread 
tags: inbox unread 
continue loading..
threads != NULL
thread != NULL
loading: 2: 
tags: 
threads != NULL
thread != NULL
loading: 3: 0000000000000009
tags: inbox unread 
threads != NULL
thread != NULL
loading: 4: 
tags: 
threads != NULL
thread != NULL
loading: 5: 
tags: 
threads != NULL
thread != NULL
loading: 6: 0000000000000004
tags: inbox unread 
threads != NULL
thread != NULL
loading: 7: 0000000000000006
tags: inbox unread 
threads != NULL
thread != NULL
loading: 8: 000000000000000a
tags: inbox signed unread 
threads != NULL
thread != NULL
loading: 9: 0000000000000005
tags: inbox unread 
```

with the following changes made to the test program:
```
diff --git a/test/test_notmuch_standalone.cc b/test/test_notmuch_standalone.cc
index 5ef0a00..4634986 100644
--- a/test/test_notmuch_standalone.cc
+++ b/test/test_notmuch_standalone.cc
@@ -189,8 +189,16 @@ int main () {
       cout << "threads != NULL" << endl;
     }
     thread = notmuch_threads_get (threads);
+    if (thread == NULL) {
+      cout << "thread == NULL" << endl;
+    } else {
+      cout << "thread != NULL" << endl;
+    }
+
     cout << "loading: " << i;
-    std::string tid = notmuch_thread_get_thread_id (thread);
+    const char * cid = notmuch_thread_get_thread_id (thread);
+    std::string tid = "";
+    if (cid != NULL) tid = cid;
     cout << ": " << tid << endl;
 
     /* get tags */
```

- gaute


More information about the notmuch mailing list