unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Carl Worth <cworth@cworth.org>
To: Thomas Schwinge <thomas@schwinge.name>, notmuch@notmuchmail.org
Subject: Re: [PATCH 2/3] new: Add all initial tags at once
Date: Thu, 27 Jan 2011 15:03:49 +1000	[thread overview]
Message-ID: <87ipxbym2y.fsf@yoom.home.cworth.org> (raw)
In-Reply-To: <87lj27vc7u.fsf@kepler.schwinge.homeip.net>

[-- Attachment #1: Type: text/plain, Size: 2636 bytes --]

On Wed, 26 Jan 2011 17:52:53 +0100, Thomas Schwinge <thomas@schwinge.name> 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):
> 
>     $ 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. 

>                                                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!

-Carl

-- 
carl.d.worth@intel.com

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2011-01-27  5:03 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-21  9:59 [PATCH 0/3] Speedups and enhancements of notmuch new Michal Sojka
2011-01-21  9:59 ` [PATCH 1/3] Do not defer maildir flag synchronization during the first " Michal Sojka
2011-01-21  9:59 ` [PATCH 1/3] new: Do not defer maildir flag synchronization during the first run Michal Sojka
2011-01-25 22:42   ` Austin Clements
2011-01-26  9:15     ` Carl Worth
2011-01-26 11:59       ` Carl Worth
2011-01-26 15:07         ` Austin Clements
2011-01-26 16:50           ` Michal Sojka
2011-01-27  5:04           ` Carl Worth
2011-01-27  5:43             ` Austin Clements
2011-01-30  0:21               ` Rob Browning
2011-01-21  9:59 ` [PATCH 2/3] new: Add all initial tags at once Michal Sojka
2011-01-26 12:10   ` Carl Worth
2011-01-26 16:52   ` Thomas Schwinge
2011-01-27  5:03     ` Carl Worth [this message]
2011-01-27  7:14       ` Carl Worth
2011-01-27 11:08         ` Michal Sojka
2011-01-21  9:59 ` [PATCH 3/3] new: Enhance progress reporting Michal Sojka
2011-01-26 12:23   ` Carl Worth
2011-01-26 13:16     ` Michal Sojka
2011-01-26 13:06   ` [PATCH] new: Print progress estimates only when we have sufficient information Michal Sojka
2011-01-26 13:49     ` Carl Worth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ipxbym2y.fsf@yoom.home.cworth.org \
    --to=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    --cc=thomas@schwinge.name \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).