[PATCH] lib: Save filenames for files detected as "not an email file" in the database.

Austin Clements amdragon at MIT.EDU
Sat Jan 21 15:49:19 PST 2012


Quoth Jani Nikula on Jan 22 at  1:00 am:
> On Fri, 20 Jan 2012 17:00:27 -0500, Austin Clements <amdragon at MIT.EDU> wrote:
> > Later runs of "notmuch new" won't scan these files again and won't
> > print warnings.
> > 
> > Various programs (Dovecot, in my case) store indexes and caches and
> > such in the maildir.  Without this, notmuch persistently complains
> > about such files.
> 
> Overall, sounds good and doing this automagically is nice. Superficially
> the code looks sensible, but I didn't really dig into it. A few nasty
> questions instead:
> 
> What happens if you delete a non-email file? Does the entry stay in the
> database?

Phooey.  I thought this worked, but you're right that it doesn't (I
even wrote a test for this, but the test was based on a false
assumption).  Non-email files do get returned by the directory
iterator, so without any changes, notmuch new will notice that they're
gone.  What I missed is that it then uses
notmuch_database_find_message_by_filename to find the "message" and
remove the filename, which won't work since there's no message to
find.

I'll have to think about this more.

> What happens if you replace a non-email file with an email file?

It will not notice because notmuch new only inspects directory mtimes.
This would require checking the mtimes of every non-email in the
database on every notmuch new.

> Does it matter what happens above?
> 
> These are corner cases, but what remains in TODO suggests that it would
> be difficult to debug and figure out if the above ever did happen to
> someone.

Yes.  It's possible this needs to get a search syntax before it is
acceptable for general use.

> BR,
> Jani.


More information about the notmuch mailing list