Quoth David Bremner on Sep 27 at 1:59 pm: > On Tue, 27 Sep 2011 16:25:58 +0300, Ali Polatel <polatel at gmail.com> wrote: > > > The problem with their design is NULL return may both mean an error > > condition and "message not found". However, we already have a similar > > function which does not have such a flaw, namely > > notmuch_database_add_message(). > > So, I take there is no way to distinguish those two outcomes? That does > sound bad. Looking at the code for notmuch-new, it looks like the return > value of notmuch_database_find_message_by_filename is used without > checking it for NULL. Austin, can you comment on that at all?
I'd be happy to distinguish these outcomes. I did notmuch_database_find_message_by_filename the way I did only to be consistent with notmuch_database_find_message. Since ndfmbf isn't entrenched yet, now is a good time to change it. The call in notmuch-new should check the return, though if it can't find the message at that point, something has gone terribly wrong. Segfaulting is never the answer, though.