[PATCH 6/6] lib: check for writable db in n_m_tags_maildir_flags

Subject:[PATCH 6/6] lib: check for writable db in n_m_tags_maildir_flags

Date:Wed, 25 May 2022 07:51:17 -0300

To:notmuch@notmuchmail.org

Cc:

From:David Bremner


The database needs to be writable because the list of stored file
names will change in general.
---
 lib/message.cc           | 4 ++++
 test/T566-lib-message.sh | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/message.cc b/lib/message.cc
index ae152df7..1df804bc 100644
--- a/lib/message.cc
+++ b/lib/message.cc
@@ -2038,6 +2038,10 @@ notmuch_message_tags_to_maildir_flags (notmuch_message_t *message)
     char *to_set, *to_clear;
     notmuch_status_t status = NOTMUCH_STATUS_SUCCESS;
 
+    status = _notmuch_database_ensure_writable (message->notmuch);
+    if (status)
+	return status;
+
     _get_maildir_flag_actions (message, &to_set, &to_clear);
 
     for (filenames = notmuch_message_get_filenames (message);
diff --git a/test/T566-lib-message.sh b/test/T566-lib-message.sh
index 3a5e9607..551898c6 100755
--- a/test/T566-lib-message.sh
+++ b/test/T566-lib-message.sh
@@ -373,7 +373,6 @@ EOF
 test_expect_equal_file EXPECTED OUTPUT
 
 test_begin_subtest "Handle converting tags to maildir flags with closed db"
-test_subtest_known_broken
 cat c_head - c_tail <<'EOF' | test_C ${MAIL_DIR}
     {
 	notmuch_status_t status;
-- 
2.35.2

_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: