[notmuch] Asynchronous tagging

Jan Janak jan at ryngle.com
Sat Nov 21 12:50:10 PST 2009

On Sat, Nov 21, 2009 at 9:01 PM, Carl Worth <cworth at cworth.org> wrote:
>> 3. I had initially put 'notmuch new' in a cron job (instead of
>> offlineimap postsync hook) and new/search would sometimes complain about
>> missing files in the maildir.  The first time this happened, it did not
>> correct itself and I ended up reimporting the database (I had moved some
>> things around so I could have been at fault).  Since then I have seen
>> these errors on a couple occasions, but they always go away upon
>> rerunning 'notmuch new'.  My guess is that it has to do with offlineimap
>> changing flags so I moved 'notmuch new' to the postsync hook and have
>> not seen the errors since.  If it is important that notmuch never runs
>> concurrently with an offlineimap sync, it should eventually go in the
>> docs.
> Thanks for the pointer.
> Does offlineimap use tmp while it's delivering message and then move
> things to new? If so, then maybe all we need to do to fix notmuch to not
> look into tmp directories?

Yes, it does. I think all delivery agents work this way, IIRC the
reason why messages are first written in tmp and then moved to new is
to make sure that clients do not see partially written messages.
Maildir has been designed to be lock-less so this is needed.

I get errors about missing files too. There are several reasons why
that can happen:

 1) A message is moved from one folder to another in other mail
clients that work with
    the Maildir spool.

 2) A client changes the flags on a message, for example, when you
read a message or
    mark it as deleted. Maildir stores flags in filenames.

 3) Message flags are updated on the IMAP server (for example when you
mark a message
    as read in gmail). Offlineimap keeps message flags synchronized.
If you mark a
    local message as read then the change is propagated to the IMAP
server and vice

 -- Jan

More information about the notmuch mailing list