From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cKROOE0KjmI6RQAAbAwnHQ (envelope-from ) for ; Wed, 25 May 2022 12:51:57 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id 6MxEOE0KjmLF0wAA9RJhRA (envelope-from ) for ; Wed, 25 May 2022 12:51:57 +0200 Received: from mail.notmuchmail.org (yantan.tethera.net [135.181.149.255]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id B973C2913F for ; Wed, 25 May 2022 12:51:57 +0200 (CEST) Received: from yantan.tethera.net (localhost [127.0.0.1]) by mail.notmuchmail.org (Postfix) with ESMTP id 908735F7A8; Wed, 25 May 2022 10:51:31 +0000 (UTC) Received: from fethera.tethera.net (fethera.tethera.net [IPv6:2607:5300:60:c5::1]) by mail.notmuchmail.org (Postfix) with ESMTP id BFD5D5F75B for ; Wed, 25 May 2022 10:51:28 +0000 (UTC) Received: by fethera.tethera.net (Postfix, from userid 1001) id 27E9C5FC11; Wed, 25 May 2022 06:51:27 -0400 (EDT) Received: (nullmailer pid 10858 invoked by uid 1000); Wed, 25 May 2022 10:51:20 -0000 From: David Bremner To: notmuch@notmuchmail.org Subject: [PATCH 6/6] lib: check for writable db in n_m_tags_maildir_flags Date: Wed, 25 May 2022 07:51:17 -0300 Message-Id: <20220525105117.10709-7-david@tethera.net> X-Mailer: git-send-email 2.35.2 In-Reply-To: <20220525105117.10709-1-david@tethera.net> References: <20220525105117.10709-1-david@tethera.net> MIME-Version: 1.0 Message-ID-Hash: FZSXOFR2RSEF5EXJSMDZMOWHIBOGZYC4 X-Message-ID-Hash: FZSXOFR2RSEF5EXJSMDZMOWHIBOGZYC4 X-MailFrom: bremner@tethera.net X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-notmuch.notmuchmail.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.3 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: DE ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1653475917; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-owner:list-unsubscribe:list-subscribe:list-post; bh=3cOgTAFt7wXbhQPjbbOUl3cvaMsbe+eKcjXGICIdBH8=; b=mMGz+zzsagUWGAArdauigYeRiCH8LNqZufsKmGHZNjId1JGYRCFQRO1cpPWVFRnnCc5k5M KHOrkKnQmOe9PDNnP7WpZZp5SJxKP6xy20uTvXFGa+ZT/KzR/Oq9STOSUeSe7sx/4+NBDr G2y3CCQEvmmAg8A4iwubdnwF/ZZQaNAfXbALuoC9+RIpl74Huwg5ztoBgnA21XddPBmNnw 8ZtKtHZsQa8eOvrvNFANnonOipe6c8A6f5KiZZnI19juFcTuvlbMW0+qghMsn3S9tYzGId MiRxJQs/mUY5EX+KEva7qDLfGgsv3DCtc7Rt3gkJEHNHyZgFqnRo/Qzl1H3HkQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1653475917; a=rsa-sha256; cv=none; b=R0Zxuu/y3CkXs9clHK0m4N1rRzVTHNIM/MuwRowpw+bl2wg0sStS4peRk3qugQJ6Vsr9Tf Wqsby5Lxpfeh7AKnoMjQOOprCoG/jprVavopzbHsedVxtp0hJkY6AUfL1TetbLbqhplmW0 vKXiNZXJfPSpufJFzPcL4wt21eOwUq7fhjaPrh3q/fdRWr8x8jw4CzwrIV2uq4/R0bQYqs A7D5RbC4BQfp2rUINP6NtqVwiqRK5Jefa1ZnfAexPpF7BvTpDvI64X1Rdd/FbnySMnbN5C i3J9hZUUAKKuQxHid4E8qKT4+USDB1SNyo6uWfxOJP91XRMNQ0oSUcu7EOetSA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Spam-Score: -1.00 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of notmuch-bounces@notmuchmail.org designates 135.181.149.255 as permitted sender) smtp.mailfrom=notmuch-bounces@notmuchmail.org X-Migadu-Queue-Id: B973C2913F X-Spam-Score: -1.00 X-Migadu-Scanner: scn0.migadu.com X-TUID: lVx6iMaSW6Cl 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