[PATCH 07/17] nmbug-status: Don't require write access
authorW. Trevor King <wking@tremily.us>
Mon, 3 Feb 2014 10:59:25 +0000 (02:59 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:59:36 +0000 (09:59 -0800)
b0/3acc57f6a52070380ce9c3c2a16f471f12a662 [new file with mode: 0644]

diff --git a/b0/3acc57f6a52070380ce9c3c2a16f471f12a662 b/b0/3acc57f6a52070380ce9c3c2a16f471f12a662
new file mode 100644 (file)
index 0000000..c7daf76
--- /dev/null
@@ -0,0 +1,105 @@
+Return-Path: <wking@tremily.us>\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 B0724429E2E\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 03:00:58 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001]\r
+       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 9IMtziHfIEIJ for <notmuch@notmuchmail.org>;\r
+       Mon,  3 Feb 2014 03:00:53 -0800 (PST)\r
+Received: from qmta01.westchester.pa.mail.comcast.net\r
+       (qmta01.westchester.pa.mail.comcast.net [76.96.62.16])\r
+       by olra.theworths.org (Postfix) with ESMTP id 5469B429E2F\r
+       for <notmuch@notmuchmail.org>; Mon,  3 Feb 2014 03:00:42 -0800 (PST)\r
+Received: from omta24.westchester.pa.mail.comcast.net ([76.96.62.76])\r
+       by qmta01.westchester.pa.mail.comcast.net with comcast\r
+       id Mmzj1n0041ei1Bg51n0hrp; Mon, 03 Feb 2014 11:00:41 +0000\r
+Received: from odin.tremily.us ([24.18.63.50])\r
+       by omta24.westchester.pa.mail.comcast.net with comcast\r
+       id Mn0g1n00M152l3L3kn0hgi; Mon, 03 Feb 2014 11:00:41 +0000\r
+Received: from mjolnir.tremily.us (unknown [192.168.0.140])\r
+       by odin.tremily.us (Postfix) with ESMTPS id 949D2FB4D4E;\r
+       Mon,  3 Feb 2014 03:00:40 -0800 (PST)\r
+Received: (nullmailer pid 692 invoked by uid 1000);\r
+       Mon, 03 Feb 2014 10:59:41 -0000\r
+From: "W. Trevor King" <wking@tremily.us>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 07/17] nmbug-status: Don't require write access\r
+Date: Mon,  3 Feb 2014 02:59:25 -0800\r
+Message-Id:\r
+ <ad3828a4c670876c16352a7bc7a147152a7cbb5b.1391424512.git.wking@tremily.us>\r
+X-Mailer: git-send-email 1.8.5.2.8.g0f6c0d1\r
+In-Reply-To: <cover.1391424512.git.wking@tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+In-Reply-To: <cover.1391424512.git.wking@tremily.us>\r
+References: <cover.1391424512.git.wking@tremily.us>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: 8bit\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net;\r
+       s=q20121106; t=1391425241;\r
+       bh=mOi9DNGt/9vulM62iNpwG3mj3ZW5v7HGmIXcbYknaVA=;\r
+       h=Received:Received:Received:Received:From:To:Subject:Date:\r
+       Message-Id:MIME-Version:Content-Type;\r
+       b=rwjileMhK8uKoK6TCNQiSxNgWO5aTLYtwDu7VD8Sdv0Ck4clN6OV/geeu019Q3+uA\r
+       hq3Mnw6tw7Yf3Szv7ZKKxGkJQgEjgmIYajPjTJMGXj2kPkmN1X+AkZdKDU+I7+is18\r
+       2dDzHCE10pAO41vsPhyD6CXUKmQ/p0X+RNKbMe+vgzMBbbAQx5pdKuZcYFgLAnSIul\r
+       //gXZ2vXmxDUDJH9vGTzdk9+S/NGYZXJm+OK+fMMsLB/Pah/oNEuZJMZreID4jls85\r
+       orFah2N9VKZN6IFue/tgsDsLrPN9zC+tsCIsTiCw8IbrWOYyh1ixBx0N6BHHq9HUXD\r
+       ecf/3PEtmddag==\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: Mon, 03 Feb 2014 11:00:58 -0000\r
+\r
+The database in only used for notmuch.Query, so there's no need for\r
+write access.  This allows nmbug-status to run while the database is\r
+being updated, without raising:\r
+\r
+  A Xapian exception occurred opening database: Unable to get write lock on …: already locked\r
+  Traceback (most recent call last):\r
+    File "./nmbug-status", line 182, in <module>\r
+      db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)\r
+    File "/…/notmuch/database.py", line 154, in __init__\r
+      self.open(path, mode)\r
+    File "/…/notmuch/database.py", line 214, in open\r
+      raise NotmuchError(status)\r
+  notmuch.errors.XapianError\r
+---\r
+ devel/nmbug/nmbug-status | 2 +-\r
+ 1 file changed, 1 insertion(+), 1 deletion(-)\r
+\r
+diff --git a/devel/nmbug/nmbug-status b/devel/nmbug/nmbug-status\r
+index 199892f..be3e28e 100755\r
+--- a/devel/nmbug/nmbug-status\r
++++ b/devel/nmbug/nmbug-status\r
+@@ -180,7 +180,7 @@ else:\r
\r
+ # main program\r
\r
+-db = notmuch.Database(mode=notmuch.Database.MODE.READ_WRITE)\r
++db = notmuch.Database(mode=notmuch.Database.MODE.READ_ONLY)\r
\r
+ if output_format == 'html':\r
+     print('''<?xml version="1.0" encoding="utf-8" ?>\r
+-- \r
+1.8.5.2.8.g0f6c0d1\r
+\r