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