unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: David Mazieres <dm-list-email-notmuch@scs.stanford.edu>
To: "Amadeusz Żołnowski" <aidecoe@aidecoe.name>
Cc: notmuch@notmuchmail.org
Subject: Re: muchsync files renames
Date: Mon, 31 Aug 2015 16:43:42 -0700	[thread overview]
Message-ID: <878u8rvxap.fsf@ta.scs.stanford.edu> (raw)
In-Reply-To: <87egijm7kw.fsf@freja.aidecoe.name>

Amadeusz Żołnowski <aidecoe@aidecoe.name> writes:

> Not necessarily. The recommended setup of notmuch for afew is that
> "notmuch new" tags messages with "new" tag only. Then afew processes all
> messages with "new" tag. So if it is a spam, then it gets "new" removed
> and "spam" added. A spam message at any time doesn't have "unread" tag
> assigned which should explain this behaviour.  So the problem is to be
> fixed on the afew side.

Let's just make sure I understand:  Your mail starts out like this:

    Path:  spam/new/nnn.MnnnPnnnQnRn.machine
    Tags:  new

Then you run afew, and afew runs

    notmuch tag -new +spam <message-ID>

You are saying that that even though maildir.synchronize_tags is true,
you end up with:

    Path:  spam/new/nnn.MnnnPnnnQnRn.machine
    Tags:  spam

That's a little surprising, because the next time you run "notmuch new,"
I would have expected it to add the unread flag based on the pathname.
But, I suppose it might make sense for notmuch to special-case that
flag.  In other words, if notmuch new finds a file called:

    spam/new/nnn.MnnnPnnnQnRn.machine:2,

Then it will add the unread tag to the Xapian database.  But maybe if it
finds a file in the new folder it doesn't add the unread flag.

But why does notmuch_message_tags_to_maildir_flag() then feel the need
to rename the file when muchsync calls it.  Muchsync should ideally
behave exactly the same as the notmuch tag command.  Specifically, when
muchsync receives a new file from the server, it does the following:

 1. create file in same directory as the server (presumably spam/new)

 2. Call the following functions on this file:
      notmuch_database_add_message()
      notmuch_message_freeze()
      notmuch_message_remove_all_tags()
      notmuch_message_add_tag() for each tag in new.tags
      if (synchronize_tags) notmuch_message_tags_to_maildir_flag()
      notmuch_message_thaw()

 3. get the current tags of the message from the server (presumably just
    spam)

 4. Call the following functions on the Message-ID:
      notmuch_message_freeze()
      notmuch_message_remove_all_tags()
      notmuch_message_add_tag() for each tag sent *by the server*
      if (synchronize_tags) notmuch_message_tags_to_maildir_flag()
      notmuch_message_thaw()

So what I'm wondering is how this is any different from what is already
happening on the server.  "notmuch new" should be doing what muchsync
does in step 2, and afew (via "notmuch tag") should be doing what
muchsync does in step 4.

Yet somehow you are saying that on the server the file stays in
spam/new/, while on the client muchsync's actions cause the file to move
to spam/cur/?  So that means there's still something I don't really
understand--possibly the series of notmuch library calls happening
server side (which I should then maybe emulate client side).

None of this is super serious, beyond a one-time extra cost, but I like
to understand things thoroughly, particularly when writing software that
manipulates critical data like mail...

It there any possibility that new.tags has a different setting on your
client and server machines?

Thanks,
David

  reply	other threads:[~2015-08-31 23:43 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-22 21:02 muchsync files renames Amadeusz Żołnowski
2015-08-23  5:41 ` David Mazieres
2015-08-23  8:44   ` Amadeusz Żołnowski
2015-08-23 20:06     ` David Mazieres
2015-08-23 20:43       ` David Mazieres
2015-08-24 22:14         ` Amadeusz Żołnowski
2015-08-26  6:31       ` Amadeusz Żołnowski
     [not found]       ` <87vbbwnbb4.fsf@freja.aidecoe.name>
     [not found]         ` <87io7wr50y.fsf@ta.scs.stanford.edu>
2015-08-31 11:59           ` Amadeusz Żołnowski
2015-08-31 17:27             ` dm-list-email-notmuch
2015-08-31 22:11               ` Amadeusz Żołnowski
2015-08-31 23:43                 ` David Mazieres [this message]
2015-09-01 22:52                   ` Amadeusz Żołnowski
2015-09-01 23:20                     ` synchronize_flags leaving files in new (was muchsync files renames) dm-list-email-notmuch
2015-09-02 21:01                       ` Amadeusz Żołnowski
2015-09-02  0:37                     ` muchsync files renames David Bremner
2015-09-02  0:46                       ` dm-list-email-notmuch
2015-09-02 21:21                       ` Amadeusz Żołnowski
2015-09-02 23:05                         ` David Bremner
2015-09-09 17:49                           ` Amadeusz Żołnowski

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=878u8rvxap.fsf@ta.scs.stanford.edu \
    --to=dm-list-email-notmuch@scs.stanford.edu \
    --cc=aidecoe@aidecoe.name \
    --cc=mazieres-sggp47c7j46624db3rharctcei@temporary-address.scs.stanford.edu \
    --cc=notmuch@notmuchmail.org \
    /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).