From b2f254d7ccd947d9d59f4cebf93e8311b7a2ceb9 Mon Sep 17 00:00:00 2001 From: Justus Winter <4winter@informatik.uni-hamburg.de> Date: Wed, 22 Feb 2012 16:17:45 +0100 Subject: [PATCH] Re: notmuch as a shared object aka library knigge --- 7f/2d50b86fccaeb22e04f8bf75ba01c8c4f3d564 | 133 ++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 7f/2d50b86fccaeb22e04f8bf75ba01c8c4f3d564 diff --git a/7f/2d50b86fccaeb22e04f8bf75ba01c8c4f3d564 b/7f/2d50b86fccaeb22e04f8bf75ba01c8c4f3d564 new file mode 100644 index 000000000..c2ef8c095 --- /dev/null +++ b/7f/2d50b86fccaeb22e04f8bf75ba01c8c4f3d564 @@ -0,0 +1,133 @@ +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 D30A7431FB6 + for ; Wed, 22 Feb 2012 07:17:54 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 rWDbHpsuGS1d for ; + Wed, 22 Feb 2012 07:17:54 -0800 (PST) +Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 0F90E431FAE + for ; Wed, 22 Feb 2012 07:17:54 -0800 (PST) +Received: from mail.jade-hamburg.de (unknown [85.183.11.228]) + (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) + (No client certificate requested) + by mail.cryptobitch.de (Postfix) with ESMTPSA id 64D6453133C + for ; Wed, 22 Feb 2012 16:17:51 +0100 (CET) +Received: by mail.jade-hamburg.de (Postfix, from userid 401) + id D054EDF2A9; Wed, 22 Feb 2012 16:17:50 +0100 (CET) +Received: from thinkbox.jade-hamburg.de (unknown [85.183.11.228]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) (Authenticated sender: teythoon) + by mail.jade-hamburg.de (Postfix) with ESMTPSA id 437FCDF2A5; + Wed, 22 Feb 2012 16:17:48 +0100 (CET) +Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77) + (envelope-from ) + id 1S0Dwv-0005pH-GE; Wed, 22 Feb 2012 16:17:45 +0100 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: quoted-printable +To: Austin Clements , +From: Justus Winter <4winter@informatik.uni-hamburg.de> +In-Reply-To: <20120221155312.GB30513@mit.edu> +References: <20120221002921.8534.57091@thinkbox.jade-hamburg.de> + <20120221155312.GB30513@mit.edu> +Message-ID: <20120222151745.4213.93513@thinkbox.jade-hamburg.de> +User-Agent: alot/0.21+ +Subject: Re: notmuch as a shared object aka library knigge +Date: Wed, 22 Feb 2012 16:17:45 +0100 +Cc: notmuch mailing list +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: Wed, 22 Feb 2012 15:17:55 -0000 + +Quoting Austin Clements (2012-02-21 16:53:12) +>Quoth Justus Winter on Feb 21 at 1:29 am: +>> Hi fellow notmuchrs, +>> = + +>> while going through the python bindings I recently came across the +>> following note in the documentation for the Database.get_directory +>> function [0]: +>> = + +>> ~~~ snip ~~~ +>> Warning +>> = + +>> This call needs a writable database in Database.MODE.READ_WRITE +>> mode. The underlying library will exit the program if this method is +>> used on a read-only database! +>> ~~~ snap ~~~ +> +>This is a bug and should be thought of as such. + +Agreed. + +>INTERNAL_ERROR should +>only be used for internal library inconsistencies (e.g., things that +>should never ever happen) [...] + +Well, I do not agree. If there is a inconsitency within the library +that library should report this to the caller and it is totally okay +to say that if the callee ignores this error, bad things will happen +(i.e. we're in unspecified behavior territory here). + +It is still not okay to kill the whole process. Imagine you're using +the alot mail client that uses libnotmuch through the python bindings +and you've just finished writing a letter when libnotmuch decides to +commit suicide and prevent the python code from saving the draft. + +For the record, there is libabcs README [0] that clearly states: + +~~~ snip ~~~ +Never call exit(), abort(), be very careful with assert() + - Always return error codes. + - Libraries need to be safe for usage in critical processes that + need to recover from errors instead of getting killed (think PID 1!). +[...] +Always provide logging/debugging, but do not clutter stderr + - Allow the app to hook the libs logging into its logging facility. + - Use conditional logging, do not filter too late. + - Do not burn cycles with printf() to /dev/null. + - By default: do not generate any output on stdout/stderr. +~~~ snap ~~~ + +>This hasn't been fixed because it derives from an interface flaw. + +Yes. And the interface flaw is the way error reporting is done within +libnotmuch. I've mentioned this once on the list and received little +feedback wrt how we can fix this kind problems if we need to change +the api to do so. + +>As always, patches welcome! + +Well, hacking on c code in my free time is not my idea of fun and I'm +not familiar with the code base, so I'd appreciate it if someone who +is in a better position to whip up a patch would step up and do so. + +Cheers, +Justus + +0: https://git.kernel.org/?p=3Dlinux/kernel/git/kay/libabc.git;a=3Dblob_pla= +in;f=3DREADME -- 2.26.2