--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id 0A6F8431FBD\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 13:12:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id zCtSSfprx-Mi for <notmuch@notmuchmail.org>;\r
+ Fri, 24 Jan 2014 13:12:50 -0800 (PST)\r
+Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com\r
+ [74.125.83.51]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 79316431FB6 for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 13:12:50 -0800\r
+ (PST)\r
+Received: by mail-ee0-f51.google.com with SMTP id b57so1190496eek.24\r
+ for <notmuch@notmuchmail.org>; Fri, 24 Jan 2014 13:12:49 -0800 (PST)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:subject:in-reply-to:references\r
+ :user-agent:date:message-id:mime-version:content-type;\r
+ bh=ozpPLqkpNp4OC3jDGoFEOHaPe9Oh5pL7fZrHTBeXCcc=;\r
+ b=QcOuKdSj39tcLw5nKaHcSRxWLg3nzVxCG/m03vtRdJHE0bW86Ui8wE1ldEiTVsDBoA\r
+ SUhJH6jqvcFHi2fYIHU2MLDhVsyrhe4KwihSifPcUjhdKXakEPez6TT7PcIGKKfaweSm\r
+ aAtMfjBJTfGpoY0gbImcoSuF7J8YGpZrZJBRUgfLmNAdKRaeaNhJiBzx026S+naNnnbJ\r
+ Q2y1gvIbmG+K2tPhgkatKsdMguXgGSfReV/6neYMscL7cpM3TB380rsW6h2uH6qOAiQm\r
+ Uwz2Fv3G3MTb0HvLzHFVW1g8MU5vqWJQRf9F1VJG5gQ9XaAMnJyGcdjpIHt06A0lQXHf\r
+ E1bA==\r
+X-Gm-Message-State:\r
+ ALoCoQlp6HkyuCSr8GKaMJk/7S4+0aPRTT4RrFkDVQc4P7BwofHkmdySrKDWysRj1SRSUAT3jzzr\r
+X-Received: by 10.15.24.142 with SMTP id j14mr14833262eeu.52.1390597969085;\r
+ Fri, 24 Jan 2014 13:12:49 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.\r
+ [88.195.111.91])\r
+ by mx.google.com with ESMTPSA id 8sm7923393eeq.15.2014.01.24.13.12.47\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
+ Fri, 24 Jan 2014 13:12:48 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 3/3] notmuch-show: detect xapian exception in query\r
+In-Reply-To: <1390479841-17045-4-git-send-email-david@tethera.net>\r
+References: <m2r47zrkkc.fsf@guru.guru-group.fi>\r
+ <1390479841-17045-1-git-send-email-david@tethera.net>\r
+ <1390479841-17045-4-git-send-email-david@tethera.net>\r
+User-Agent: Notmuch/0.17+44~ge3b4cd9 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Fri, 24 Jan 2014 23:12:46 +0200\r
+Message-ID: <87txctf5ip.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://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: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 24 Jan 2014 21:12:58 -0000\r
+\r
+On Thu, 23 Jan 2014, David Bremner <david@tethera.net> wrote:\r
+> We want to return an error status, not 0 or (worse) segfault.\r
+> ---\r
+> notmuch-show.c | 6 +++++-\r
+> test/T520-show.sh | 1 -\r
+> 2 files changed, 5 insertions(+), 2 deletions(-)\r
+>\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index 528694b..b162738 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -1015,9 +1015,13 @@ do_show (void *ctx,\r
+> notmuch_messages_t *messages;\r
+> notmuch_status_t status, res = NOTMUCH_STATUS_SUCCESS;\r
+> \r
+> + threads = notmuch_query_search_threads (query);\r
+> + if (! threads)\r
+> + return NOTMUCH_STATUS_XAPIAN_EXCEPTION;\r
+\r
+This should just return 1 or something. See how the function eventually\r
+returns res != NOTMUCH_STATUS_SUCCESS instead of notmuch_status_t. And\r
+threads == NULL is not guaranteed to mean an exception occurred anyway.\r
+\r
+Otherwise the patch LGTM, and is in line with the error handling in\r
+notmuch search, which does not segfault on similar queries.\r
+\r
+BR,\r
+Jani.\r
+\r
+\r
+> +\r
+> sp->begin_list (sp);\r
+> \r
+> - for (threads = notmuch_query_search_threads (query);\r
+> + for ( ;\r
+> notmuch_threads_valid (threads);\r
+> notmuch_threads_move_to_next (threads))\r
+> {\r
+> diff --git a/test/T520-show.sh b/test/T520-show.sh\r
+> index bdd9d71..0657c99 100755\r
+> --- a/test/T520-show.sh\r
+> +++ b/test/T520-show.sh\r
+> @@ -6,7 +6,6 @@ test_description='"notmuch show"'\r
+> add_email_corpus\r
+> \r
+> test_begin_subtest "exit code for show invalid query"\r
+> -test_subtest_known_broken\r
+> notmuch show foo..\r
+> exit_code=$?\r
+> test_expect_equal 1 $exit_code\r
+> -- \r
+> 1.8.5.2\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r