Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 0F8CB429E26 for ; Tue, 27 Sep 2011 09:59:09 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.3 X-Spam-Level: X-Spam-Status: No, score=-2.3 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yYhkVkB6-Onn for ; Tue, 27 Sep 2011 09:59:08 -0700 (PDT) Received: from tempo.its.unb.ca (tempo.its.unb.ca [131.202.1.21]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 54345431FD0 for ; Tue, 27 Sep 2011 09:59:08 -0700 (PDT) Received: from convex-new.cs.unb.ca ([131.202.13.154]) by tempo.its.unb.ca (8.13.8/8.13.8) with ESMTP id p8RGx2If006103; Tue, 27 Sep 2011 13:59:02 -0300 Received: from bremner by convex-new.cs.unb.ca with local (Exim 4.72) (envelope-from ) id 1R8azm-0001G5-Cx; Tue, 27 Sep 2011 13:59:02 -0300 From: David Bremner To: Ali Polatel , notmuch@notmuchmail.org Subject: Re: Concerns regarding some library functions In-Reply-To: <871uv2unfd.fsf@gmail.com> References: <871uv2unfd.fsf@gmail.com> User-Agent: Notmuch/0.6db1 (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Tue, 27 Sep 2011 13:59:02 -0300 Message-ID: <87fwjhx6p5.fsf@convex-new.cs.unb.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Austin Clements X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2011 16:59:09 -0000 On Tue, 27 Sep 2011 16:25:58 +0300, Ali Polatel 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