From 972d34d107f5d4aa55f87fd374a239f969a41fe1 Mon Sep 17 00:00:00 2001 From: David Bremner Date: Sun, 16 Aug 2015 14:57:54 +0200 Subject: [PATCH] Re: Enabling and disabling maildir.synchronize_flags --- 8b/aac0783796e757a558c0972b553b8c93dac65a | 102 ++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 8b/aac0783796e757a558c0972b553b8c93dac65a diff --git a/8b/aac0783796e757a558c0972b553b8c93dac65a b/8b/aac0783796e757a558c0972b553b8c93dac65a new file mode 100644 index 000000000..cb7d39cd9 --- /dev/null +++ b/8b/aac0783796e757a558c0972b553b8c93dac65a @@ -0,0 +1,102 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id 97F6C6DE021E + for ; Sun, 16 Aug 2015 05:58:54 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: 0.125 +X-Spam-Level: +X-Spam-Status: No, score=0.125 tagged_above=-999 required=5 tests=[AWL=0.125] + autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id ZzCkr77msS7v for ; + Sun, 16 Aug 2015 05:58:52 -0700 (PDT) +Received: from gitolite.debian.net (gitolite.debian.net [87.98.215.224]) + by arlo.cworth.org (Postfix) with ESMTPS id A74F16DE009A + for ; Sun, 16 Aug 2015 05:58:52 -0700 (PDT) +Received: from remotemail by gitolite.debian.net with local (Exim 4.80) + (envelope-from ) + id 1ZQxVk-0002n2-Bl; Sun, 16 Aug 2015 12:58:04 +0000 +Received: (nullmailer pid 17358 invoked by uid 1000); Sun, 16 Aug 2015 + 12:57:54 -0000 +From: David Bremner +To: David Mazieres , + notmuch@notmuchmail.org +Subject: Re: Enabling and disabling maildir.synchronize_flags +In-Reply-To: <874mjzblwc.fsf@ta.scs.stanford.edu> +References: <87r3orbqfn.fsf@ta.scs.stanford.edu> + <87r3n3fu7d.fsf@maritornes.cs.unb.ca> <874mjzblwc.fsf@ta.scs.stanford.edu> +User-Agent: Notmuch/0.20.2 (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Sun, 16 Aug 2015 14:57:54 +0200 +Message-ID: <87614ffl0t.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.18 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sun, 16 Aug 2015 12:58:54 -0000 + +David Mazieres writes: + + +> So my question remains, what's the easiest safe way to re-enable +> synchronize_flags after disabling it? (Safe meaning it won't change any +> tags.) It could be that there's a very simple answer, in which case +> sticking it in the man page might be nice. + +I can't think of a simple, safe, and fast answer. + +As a hack, if you run notmuch new right before you enable +synchronize_flags, then next the next notmuch new will not notice the +fact that flags are out of sync [1]. I don't think this really qualifies +as safe, as the fact that the maildir is out of sync with the database +will eventually bite you. Maybe in some special circumstances this +helps. + +Otherwise, two things to that might speed up the process. + +1) dump and restore both take queries, so you can only worry about the +maildir relevant flags. + +2) when the lastmod changes go in, it seems like you could run the first + notmuch new after enabling tag synchonizing, and dump only the tag + changes since a checkpoint lastmod value. This would allow rolling + back the unwanted tag changes. + + +[1]: see this potential test, if for some reason we wanted to + guarantee this behaviours. + +test_begin_subtest "Turning on maildir.synchronize_flags w/o backup" +OLDCONFIG=$(notmuch config get maildir.synchronize_flags) + +notmuch config set maildir.synchronize_flags true +add_message [subject]='"Message to test ignoring flags"' \ + [date]='"Sat, 01 Jan 2000 12:00:00 -0000"' \ + [filename]='ignoring-flags' [dir]=cur +${NOTMUCH_NEW} +notmuch dump > EXPECTED + +notmuch config set maildir.synchronize_flags false +# make flags out of sync with db +mv ${MAIL_DIR}/cur/ignoring-flags ${MAIL_DIR}/cur/ignoring-flags,S +${NOTMUCH_NEW} + +notmuch config set maildir.synchronize_flags true +${NOTMUCH_NEW} +notmuch dump > OUTPUT +notmuch config set maildir.synchronize_flags "${OLDCONFIG}" +test_expect_equal_file EXPECTED OUTPUT -- 2.26.2