Re: Concerns regarding some library functions

Subject: Re: Concerns regarding some library functions

Date: Tue, 27 Sep 2011 13:59:02 -0300

To: Ali Polatel, notmuch@notmuchmail.org

Cc: Austin Clements

From: David Bremner


On Tue, 27 Sep 2011 16:25:58 +0300, Ali Polatel <polatel@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 am not providing a patch here considering the simplicity of the
> problem but if anyone needs elaboration, I will be happy to submit a
> patch.

Well, also all the places that call these functions in the library and
command line client would need to be modified, as well as the go and
python bindings.  So it isn't completely trivial. Nor is is terribly
difficult of course.

d



Thread: