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

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

Date: Fri, 30 Sep 2011 11:21:38 +0200

To: Austin Clements

Cc: notmuch@notmuchmail.org

From: Sebastian Spaeth


On Thu, 29 Sep 2011 11:01:47 -0400, Austin Clements <amdragon@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
part-000.sig (application/pgp-signature)

Thread: