From 1fa7c422adc0f15009ec9a9d5de7dc2829d5684e Mon Sep 17 00:00:00 2001 From: David Bremner Date: Tue, 9 Feb 2016 07:56:45 +2000 Subject: [PATCH] Re: [PATCH] cli: avoid non-zero exits in notmuch insert --keep --- 71/7c4af046df28a4f166815b46b15f1ee01468ef | 91 +++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 71/7c4af046df28a4f166815b46b15f1ee01468ef diff --git a/71/7c4af046df28a4f166815b46b15f1ee01468ef b/71/7c4af046df28a4f166815b46b15f1ee01468ef new file mode 100644 index 000000000..5c61cc4ca --- /dev/null +++ b/71/7c4af046df28a4f166815b46b15f1ee01468ef @@ -0,0 +1,91 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by arlo.cworth.org (Postfix) with ESMTP id A76BF6DE0A7F + for ; Mon, 8 Feb 2016 03:56:51 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at cworth.org +X-Spam-Flag: NO +X-Spam-Score: -0.308 +X-Spam-Level: +X-Spam-Status: No, score=-0.308 tagged_above=-999 required=5 tests=[AWL=0.243, + RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001] autolearn=disabled +Received: from arlo.cworth.org ([127.0.0.1]) + by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id wkJ8JvZGtL1F for ; + Mon, 8 Feb 2016 03:56:49 -0800 (PST) +Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197]) + by arlo.cworth.org (Postfix) with ESMTPS id C98786DE0261 + for ; Mon, 8 Feb 2016 03:56:49 -0800 (PST) +Received: from remotemail by fethera.tethera.net with local (Exim 4.84) + (envelope-from ) + id 1aSkQJ-0007W9-1Q; Mon, 08 Feb 2016 06:56:07 -0500 +Received: (nullmailer pid 1006 invoked by uid 1000); + Mon, 08 Feb 2016 11:56:46 -0000 +From: David Bremner +To: Maarten Aertsen , + Notmuch Mail +Subject: Re: [PATCH] cli: avoid non-zero exits in notmuch insert --keep +In-Reply-To: <20160207211340.15609.92485@kardo2.rtsn.nl> +References: <20160124154800.19103.24730@kardo2.rtsn.nl> + <87a8nsz8bd.fsf@zancas.localnet> <20160207211340.15609.92485@kardo2.rtsn.nl> +User-Agent: Notmuch/0.21+5~gca076ce (http://notmuchmail.org) Emacs/24.5.1 + (x86_64-pc-linux-gnu) +Date: Mon, 08 Feb 2016 07:56:45 -0400 +Message-ID: <87r3gn8lfm.fsf@maritornes.cs.unb.ca> +MIME-Version: 1.0 +Content-Type: text/plain +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.20 +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: Mon, 08 Feb 2016 11:56:51 -0000 + +Maarten Aertsen writes: + +> In the case of any failure, we now return EX_TEMPFAIL (a sendmail +> convention, defined in sysexits.h) to signal to the LDA that it should +> retry later. This prevents a direct reject or bounce of e-mail. + +We talked a bit on IRC about the portability of sysexits.h. Afaik, it's +available in GNU systems, on *BSD systems, and on OS/X. We can also +borrow the gnulib copy if we need a compatability version. + +> +notmuch_bool_t notmuch_has_unmatched_db_uuid (notmuch_database_t *notmuch); +> void notmuch_exit_if_unmatched_db_uuid (notmuch_database_t *notmuch); + +It's a bit unfortunate to end up with two such functions, but I guess we +could migrate everything to has_unmatched_db_uuid. The double negative +is a bit confusing too, it seems like it would be more natural to have a +_has_matching_db_uuid +> + status = notmuch_database_open (notmuch_config_get_database_path (config), +> + NOTMUCH_DATABASE_MODE_READ_WRITE, ¬much); +> + if (! status) { +> + /* with keep, send EX_TEMPFAIL per sysexits.h to invite the caller to +> + * retry at some later point and avoid permanent failure */ +> + if (notmuch_has_unmatched_db_uuid(notmuch)) +> + exit (keep ? EX_TEMPFAIL : EXIT_FAILURE); + +We're a bit fussy about spaces; see devel/STYLE + +I'd invite brainstorming about whether mismatched UUID is really a +temporary failure. Unlike a lock, I don't see it going away without +user/admin intervention. Actually, someone even specifying a UUID when +calling notmuch insert would be a bit surprising. + +I suspect some of the tests in T070-insert.sh could/should be updated +for changed exit values. + +d + + + + -- 2.26.2