From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 22C87431FD0 for ; Wed, 26 Jan 2011 21:03:51 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.99 X-Spam-Level: X-Spam-Status: No, score=-0.99 tagged_above=-999 required=5 tests=[ALL_TRUSTED=-1, T_MIME_NO_TEXT=0.01] 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 GQIpLTTk20h2; Wed, 26 Jan 2011 21:03:50 -0800 (PST) Received: from yoom.home.cworth.org (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 4A3EB431FB5; Wed, 26 Jan 2011 21:03:50 -0800 (PST) Received: by yoom.home.cworth.org (Postfix, from userid 1000) id 5D6252540DF; Thu, 27 Jan 2011 15:03:49 +1000 (EST) From: Carl Worth To: Thomas Schwinge , notmuch@notmuchmail.org Subject: Re: [PATCH 2/3] new: Add all initial tags at once In-Reply-To: <87lj27vc7u.fsf@kepler.schwinge.homeip.net> References: <1295603977-14326-1-git-send-email-sojkam1@fel.cvut.cz> <1295603977-14326-4-git-send-email-sojkam1@fel.cvut.cz> <87lj27vc7u.fsf@kepler.schwinge.homeip.net> User-Agent: Notmuch/0.5 (http://notmuchmail.org) Emacs/23.2.1 (i486-pc-linux-gnu) Date: Thu, 27 Jan 2011 15:03:49 +1000 Message-ID: <87ipxbym2y.fsf@yoom.home.cworth.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; protocol="application/pgp-signature" 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: Thu, 27 Jan 2011 05:03:51 -0000 --=-=-= Content-Transfer-Encoding: quoted-printable On Wed, 26 Jan 2011 17:52:53 +0100, Thomas Schwinge = wrote: > I do support the patch's idea (which was recently committed; and what > follows in this message is not at all directed towards Michal, who wrote > this patch) -- but what about return values checking? This is one aspect > of the notmuch C code (which I generally consider to be nice to read and > of high quality, as I said before already), that I consider totally > lacking -- there are literally hundreds of C functions calls where the > return values are just discarded. This is bad. For example (simulating > a full disk): >=20 > $ notmuch dump > /dev/full > $ echo $? > 0 All very well pointed out. This is clearly something we need to fix. > Other languages have the concept of exceptions; C doesn't, so we're > supposed to put some ``ABORT_IF_NOT_NOTMUCH_STATUS_SUCCESS(ret)'' > statements after each and every non-void (etc.) C function call. Or make > the functions abort themselves (which is not a too good idea, as we > surely agree). Or use a different programming language -- now, at the > present state, it wouldn't be too painful to switch, in my opinion. (I > won't suggest any specific language, though.) I wouldn't have any problem with anyone re-implementing notmuch in some other language than C. But that's not something I would be likely to work on myself, I don't think.=20 > If staying with C (which I > don't object, either), then this needs a whole code audit, and a lot of > discipline in the future. Even a code audit and developer discipline won't be enough here. We'll still miss things. What we need is exhaustive testing. A great approach is to take calls like malloc, open, read, write, etc. and at each site, fork() and fail the call along one path, (which should then exit with a failure), and then let the other path continue. Just a few hours ago I attended an interesting talk by Rusty Russell in which he talks about a CCAN module he has written called failtest which provides an implementation of this kind of testing. I'd love to see something like that integrated with notmuch. > Comments? (And I hope this doesn't sound too harsh :-) -- but it is a > serious programming issue.) Please don't apologize! It would be a shame if people didn't share problems they notice in the code. Being able to hear those kinds of things is one of the great benefits I get from publishing this code as free software. So, please, keep the suggestions coming! =2DCarl =2D-=20 carl.d.worth@intel.com --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iD8DBQFNQPy16JDdNq8qSWgRApDWAJ0U3CQ6cOxupLlCD1bp/Jnr1/uYLwCfUBtV OOs4E3HASiZbCQ6oJeyeZ+g= =nDGm -----END PGP SIGNATURE----- --=-=-=--