unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Bremner <david@tethera.net>
To: Sean Whitton <spwhitton@spwhitton.name>, notmuch@notmuchmail.org
Subject: Re: Forcing a sync of maildir flags?
Date: Sun, 01 May 2022 20:23:19 -0300	[thread overview]
Message-ID: <87ee1c7s7s.fsf@tethera.net> (raw)
In-Reply-To: <87d0a7zpfd.fsf@iris.silentflame.com>

Sean Whitton <spwhitton@spwhitton.name> writes:
>
> Thanks.  Let me record in this thread what I will believe it will take a
> reproduce this in a test:
>
> 1) inbox and sent are Maildirs
>
> 1) Compose mail to a mailing list which will return copies of
>    submissions, with `Fcc: sent -unread`

Since you mention Fcc, are you using notmuch insert?

>
> 2) notmuch new, and in post-new hook, notmuch tag -unread -- folder:sent
>
> Expected result: copy of message in both inbox and sent has Seen flag
>
> Actual result: only copy of message in sent has Seen flag

I tried to simulate this in the form of a test. I'm not using notmuch
insert here, but I manage to trigger similar looking behaviour:

test_begin_subtest "duplicate file with seen flag"
test_subtest_known_broken
mkdir -p "${MAIL_DIR}"/sent/{cur,new,tmp}
notmuch config set maildir.synchronize_flags true
add_message '[subject]="seen message"'  '[filename]=fcc-file:2,S' '[dir]=sent/cur'
notmuch new
# for debugging
notmuch search subject:"seen message"
mkdir -p "${MAIL_DIR}"/inbox/{cur,new,tmp}
cp "${gen_msg_filename}" "${MAIL_DIR}"/inbox/new/copied-file:2,
notmuch new
# for debugging
notmuch search subject:"seen message"
# next line is a no-op, because it already doesn't have the unread tag
notmuch tag -unread folder:sent
count=$(notmuch search --output=files subject:"seen message" | grep -c ',S$')
# for debugging:
notmuch search --output=files subject:"seen message"
test_expect_equal "${count}" "2"

This has the output

    BROKEN duplicate file with seen flag
            --- T050-new.41.expected	2022-05-01 22:51:45.644747316 +0000
            +++ T050-new.41.output	2022-05-01 22:51:45.644747316 +0000
            @@ -1 +1 @@
            -2
            +1
    No new mail.
    thread:0000000000000011   2001-01-05 [1/1] Notmuch Test Suite; seen message (inbox)
    Processed 1 file in almost no time.
    No new mail.
    thread:0000000000000011   2001-01-05 [1/1(2)] Notmuch Test Suite; seen message (inbox)
    /home/bremner/software/upstream/notmuch/test/tmp.T050-new/mail/sent/cur/fcc-file:2,S
    /home/bremner/software/upstream/notmuch/test/tmp.T050-new/mail/inbox/new/copied-file:2,

The key point is that from notmuch's point of view the message never has
the unread tag, so there is no change for "notmuch tag" to sync with
maildir flags.

It doesn't seem to make a difference if I put the copy in inbox/new or
inbox/cur, so I don't think it is related to the previous efforts not to
prematurely move files out of new/.

As far as I can tell, notmuch-new (unlike notmuch-insert) does not call
notmuch_message_tags_to_maildir_flags, so the maildir flags on the newly
discovered copy are not updated. Perhaps it should, but that seems like
a pretty big change, so I want to proceed with caution.

  reply	other threads:[~2022-05-01 23:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20  4:58 Forcing a sync of maildir flags? Sean Whitton
2020-02-20 12:22 ` David Bremner
2020-02-20 13:21   ` David Bremner
2020-02-20 21:19   ` Sean Whitton
2020-02-21  0:06     ` David Bremner
2020-02-21 19:54       ` Sean Whitton
2022-05-01 23:23         ` David Bremner [this message]
2022-05-02 23:24           ` Sean Whitton
2022-05-03 12:14             ` David Bremner
2022-05-03 23:59               ` Sean Whitton
2022-03-22 19:44   ` Sean Whitton
2022-04-05  4:48     ` Sean Whitton
2022-04-13 10:27       ` Gregor Zattler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ee1c7s7s.fsf@tethera.net \
    --to=david@tethera.net \
    --cc=notmuch@notmuchmail.org \
    --cc=spwhitton@spwhitton.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).