--- /dev/null
+Return-Path: <bremner@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 3B18A6DE02D1\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Apr 2016 09:19:24 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.02\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.02 tagged_above=-999 required=5 tests=[AWL=-0.009,\r
+ SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] 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 lNKKcNUlESRF for <notmuch@notmuchmail.org>;\r
+ Sat, 2 Apr 2016 09:19:16 -0700 (PDT)\r
+Received: from fethera.tethera.net (fethera.tethera.net [198.245.60.197])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 6133F6DE0243\r
+ for <notmuch@notmuchmail.org>; Sat, 2 Apr 2016 09:19:16 -0700 (PDT)\r
+Received: from remotemail by fethera.tethera.net with local (Exim 4.84)\r
+ (envelope-from <bremner@tethera.net>)\r
+ id 1amOH6-0004fL-Im; Sat, 02 Apr 2016 12:19:48 -0400\r
+Received: (nullmailer pid 13165 invoked by uid 1000);\r
+ Sat, 02 Apr 2016 16:19:12 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,\r
+ Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH 2/2] test: add test-binary to print the number of ghost\r
+ messages\r
+Date: Sat, 2 Apr 2016 13:19:02 -0300\r
+Message-Id: <1459613942-13098-2-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.8.0.rc3\r
+In-Reply-To: <1459613942-13098-1-git-send-email-david@tethera.net>\r
+References: <1459606541-23889-1-git-send-email-dkg@fifthhorseman.net>\r
+ <1459613942-13098-1-git-send-email-david@tethera.net>\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: Sat, 02 Apr 2016 16:19:24 -0000\r
+\r
+This one-liner seems preferable to the complications of depending on\r
+delve, getting the binary name right and parsing the output.\r
+---\r
+\r
+I wasn't sure where exactly you wanted to count ghosts, so here is\r
+some example code to do the counting. Feel free to modify to suit your\r
+purposes.\r
+\r
+ test/Makefile.local | 4 ++++\r
+ test/ghost-report.cc | 12 ++++++++++++\r
+ 2 files changed, 16 insertions(+)\r
+ create mode 100644 test/ghost-report.cc\r
+\r
+diff --git a/test/Makefile.local b/test/Makefile.local\r
+index 30d420e..022f2cf 100644\r
+--- a/test/Makefile.local\r
++++ b/test/Makefile.local\r
+@@ -38,6 +38,9 @@ $(dir)/parse-time: $(dir)/parse-time.o parse-time-string/parse-time-string.o\r
+ $(dir)/make-db-version: $(dir)/make-db-version.o\r
+ $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS)\r
+ \r
++$(dir)/ghost-report: $(dir)/ghost-report.o\r
++ $(call quiet,CXX) $^ -o $@ $(LDFLAGS) $(XAPIAN_LDFLAGS)\r
++\r
+ .PHONY: test check\r
+ \r
+ test_main_srcs=$(dir)/arg-test.c \\r
+@@ -47,6 +50,7 @@ test_main_srcs=$(dir)/arg-test.c \\r
+ $(dir)/smtp-dummy.c \\r
+ $(dir)/symbol-test.cc \\r
+ $(dir)/make-db-version.cc \\r
++ $(dir)/ghost-report.cc\r
+ \r
+ test_srcs=$(test_main_srcs) $(dir)/database-test.c\r
+ \r
+diff --git a/test/ghost-report.cc b/test/ghost-report.cc\r
+new file mode 100644\r
+index 0000000..1739be4\r
+--- /dev/null\r
++++ b/test/ghost-report.cc\r
+@@ -0,0 +1,12 @@\r
++#include <iostream>\r
++#include <xapian.h>\r
++\r
++int main(int argc, char **argv) {\r
++\r
++ if (argc < 2) {\r
++ std::cerr << "usage: ghost-report xapian-dir" << std::endl;\r
++ }\r
++\r
++ Xapian::Database db(argv[1]);\r
++ std::cout << db.get_termfreq("Tghost") << std::endl;\r
++}\r
+-- \r
+2.8.0.rc3\r
+\r