[PATCH v6 00/17] Fix 'notmuch new' atomicity issues

Sebastian Spaeth Sebastian at sspaeth.de
Fri Sep 30 02:21:38 PDT 2011


On Thu, 29 Sep 2011 11:01:47 -0400, Austin Clements <amdragon at MIT.EDU> wrote:
> Quoth Sebastian Spaeth on Sep 28 at  6:36 pm:
> > db.find_message_by_filename("moo")
> > Internal error: Failure to ensure database is writable
> > (lib/directory.cc:100).

> It appears that looking up a directory requires a writable database
> because notmuch will try to *create* a database document for the
> directory if one doesn't already exist.  This is clearly wrong
> behavior for a "find" function.

First of all, I consider libnotmuch exiting, taking python down, an
outright bug. So we should modify this case to return:
NOTMUCH_STATUS_READ_ONLY_DATABASE

so I can at least give some sensible error than having an angry mob run
with pitchforks towards me.

Ideally, we don't need READ-WRITE dbs for the find :-)

As it is, the same issue happens with the
notmuch_database_get_directory call, which should be protected in the
same manner (and probably has the same root cause). It is debatable
whether get_directory should be creating a directory on demand, I guess,
but it should never crash.

I have documented this in the python bindings, so it's not super urgent.
But it's dangerous and wrong nonetheless.

Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://notmuchmail.org/pipermail/notmuch/attachments/20110930/6d8d957a/attachment.pgp>


More information about the notmuch mailing list