Re: [PATCH 1/2] lib: Add back the synchronization of 'T' flag with deleted tag.

Subject: Re: [PATCH 1/2] lib: Add back the synchronization of 'T' flag with deleted tag.

Date: Tue, 17 Jan 2012 00:12:36 -0500

To: Jani Nikula,


From: Antoine Beaupré

On Sat, 07 Jan 2012 00:37:07 +0200, Jani Nikula <> wrote:
> On Sat, 16 Jul 2011 23:56:12 -0400, Antoine Beaupré <> wrote:
> > +    // TODO: this should probably be moved up in the stack to avoid
> > +    // opening the config file on every message (!)
> > +    config = notmuch_config_open (ctx, NULL, NULL);
> The config file is for notmuch the command line tool, *not* for the
> lib. You can't call the cli from from the lib. The config (or command
> line argument) should be passed as argument, but that would require
> changing the lib interface.

I see. I wasn't aware of that.

> > + *   'T' iff the message has the "trashed" tag and
> > + *   state->reckless_trash is TRUE.
> "trashed" tag?

That should probably be "deleted".

> The comment (and the commit message) is incorrect. You only check for
> reckless_trash in maildir_flags_to_tags, not tags_to_maildir_flags.
> With this patch, one-way syncing from tags to flags would be done
> unconditionally. And if I understand the problem correctly, you're
> fixing the less critical one of the two!

Indeed! What an oversight...

> I am wondering (but I'm too tired to check) if the original problem
> could be avoided by simply refusing to sync "deleted" tag to 'T' flag if
> there are more than one file for that message.

That would be a great idea.

> This is a dangerous feature, which is why it was originally
> disabled. Accidentally deleting mail is not something people take
> lightly. They'll be amused by "reckless trash" - until it recklessly
> deletes an important mail.

Yes, I understand this.

> However, something like this might be a useful feature to have for
> people who want to delete mail. It would need good tests to accompany
> it, though.

And to be honest, that's where I got off the boat. :) It just got too
hard, and anyways I use a custom script that deletes mails from notmuch
search tag:deleted, so syncing that flag isn't so important for me.

I guess this got everything covered for me. I would be ready to accept
this patch being dropped from the queue, although I think it's a key
step in having a more general tag to maildir flags synchronisation
strategy that would allow to run notmuch from multiple clients, without
having to sync databases around.

Thanks for the review, this patch is indeed not ready, and I am not sure
when I will have time to push it further.



Modern man has a kind of poverty of the spirit which stands
in great contrast to his remarkable scientific and technological
achievements. We've learned to walk in outer space and yet we
haven't learned to walk to earth as brothers and sisters.
                        - Dr. Martin Luther King, Jr.
part-000.sig (application/pgp-signature)