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