These two functions don't fail gracefully when editing a removed
message:
BROKEN edit property on removed message without uncaught exception
--- T610-message-property.20.EXPECTED 2023-02-27 11:33:25.792764376 +0000
+++ T610-message-property.20.OUTPUT 2023-02-27 11:33:25.793764381 +0000
@@ -1,2 +1,3 @@
== stdout ==
== stderr ==
+terminate called after throwing an instance of 'Xapian::DocNotFoundError'
The other functions appear to be safe.
---
test/T610-message-property.sh | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)
diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index 2685f3b5..57ef018e 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -362,4 +362,38 @@ for (key,val) in msg.get_properties("testkey",True):
EOF
test_expect_equal_file /dev/null OUTPUT
+test_begin_subtest "edit property on removed message without uncaught exception"
+test_subtest_known_broken
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+EXPECT0(notmuch_database_remove_message (db, notmuch_message_get_filename (message)));
+stat = notmuch_message_remove_property (message, "example", "example");
+const char *stat_str = notmuch_database_status_string (db);
+if (stat_str)
+ fputs (stat_str, stderr);
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+== stderr ==
+A Xapian exception occurred at message-property.cc:XXX: No termlist for document 54
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+add_email_corpus
+
+test_begin_subtest "remove all properties on removed message without uncaught exception"
+test_subtest_known_broken
+cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
+EXPECT0(notmuch_database_remove_message (db, notmuch_message_get_filename (message)));
+notmuch_message_remove_all_properties_with_prefix (message, "");
+const char *stat_str = notmuch_database_status_string (db);
+if (stat_str)
+ fputs (stat_str, stderr);
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+== stderr ==
+A Xapian exception occurred at message-property.cc:XXX: No termlist for document 54
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
test_done
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org