unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] test: uncaught exception when editing properties of a removed message
@ 2023-02-27 11:56 Kevin Boulain
  2023-02-27 11:56 ` [PATCH 2/2] lib/message-property: catch xapian exceptions Kevin Boulain
  0 siblings, 1 reply; 11+ messages in thread
From: Kevin Boulain @ 2023-02-27 11:56 UTC (permalink / raw)
  To: notmuch; +Cc: Kevin Boulain

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 | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/T610-message-property.sh b/test/T610-message-property.sh
index 2685f3b5..944e1810 100755
--- a/test/T610-message-property.sh
+++ b/test/T610-message-property.sh
@@ -362,4 +362,28 @@ 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)));
+EXPECT0(notmuch_message_remove_property (message, "example", "example"));
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
+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)));
+EXPECT0(notmuch_message_remove_all_properties_with_prefix (message, ""));
+EOF
+cat <<'EOF' >EXPECTED
+== stdout ==
+== stderr ==
+EOF
+test_expect_equal_file EXPECTED OUTPUT
+
 test_done

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2023-03-30 10:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-27 11:56 [PATCH 1/2] test: uncaught exception when editing properties of a removed message Kevin Boulain
2023-02-27 11:56 ` [PATCH 2/2] lib/message-property: catch xapian exceptions Kevin Boulain
2023-03-27 11:30   ` David Bremner
2023-03-27 15:39     ` [PATCH v2 1/2] test: uncaught exception when editing properties of a removed message Kevin Boulain
2023-03-29 10:42       ` David Bremner
2023-03-29 16:19         ` [PATCH v3 " Kevin Boulain
2023-03-30 10:17           ` David Bremner
2023-03-29 16:19         ` [PATCH v3 2/2] lib/message-property: catch xapian exceptions Kevin Boulain
2023-03-29 16:21         ` [PATCH v2 1/2] test: uncaught exception when editing properties of a removed message Kevin Boulain
2023-03-27 15:39     ` [PATCH v2 2/2] lib/message-property: catch xapian exceptions Kevin Boulain
2023-03-27 15:40     ` [PATCH " Kevin Boulain

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).