From: W. Trevor King Date: Mon, 10 Feb 2014 18:40:28 +0000 (+1600) Subject: [PATCH v2 07/20] nmbug-status: Don't require write access X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=e937261d150f7efb37662ac8c2eadc07c64edfaa;p=notmuch-archives.git [PATCH v2 07/20] nmbug-status: Don't require write access --- diff --git a/1d/c7df9590b432a0d3fda28fdd6a861969169b60 b/1d/c7df9590b432a0d3fda28fdd6a861969169b60 new file mode 100644 index 000000000..9062fd71b --- /dev/null +++ b/1d/c7df9590b432a0d3fda28fdd6a861969169b60 @@ -0,0 +1,106 @@ +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 9A2C6429E44 + for ; Mon, 10 Feb 2014 10:42:19 -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 bbdV5PU532p9 for ; + Mon, 10 Feb 2014 10:42:14 -0800 (PST) +Received: from qmta13.westchester.pa.mail.comcast.net + (qmta13.westchester.pa.mail.comcast.net [76.96.59.243]) + by olra.theworths.org (Postfix) with ESMTP id 9692A431E62 + for ; Mon, 10 Feb 2014 10:41:56 -0800 (PST) +Received: from omta21.westchester.pa.mail.comcast.net ([76.96.62.72]) + by qmta13.westchester.pa.mail.comcast.net with comcast + id Qh2Z1n0041ZXKqc5DihwkL; Mon, 10 Feb 2014 18:41:56 +0000 +Received: from odin.tremily.us ([24.18.63.50]) + by omta21.westchester.pa.mail.comcast.net with comcast + id Qihv1n006152l3L3hihvsS; Mon, 10 Feb 2014 18:41:56 +0000 +Received: from mjolnir.tremily.us (unknown [192.168.0.140]) + by odin.tremily.us (Postfix) with ESMTPS id 0F19210167AF; + Mon, 10 Feb 2014 10:41:55 -0800 (PST) +Received: (nullmailer pid 1257 invoked by uid 1000); + Mon, 10 Feb 2014 18:40:45 -0000 +From: "W. Trevor King" +To: notmuch@notmuchmail.org +Subject: [PATCH v2 07/20] nmbug-status: Don't require write access +Date: Mon, 10 Feb 2014 10:40:28 -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=1392057716; + bh=mOi9DNGt/9vulM62iNpwG3mj3ZW5v7HGmIXcbYknaVA=; + h=Received:Received:Received:Received:From:To:Subject:Date: + Message-Id:MIME-Version:Content-Type; + b=RXowinSxD4MhwwZBsJzCwC2p2X0soQMSPoby4XO6U1dD/pihaxyrMTVrdN5pffiNn + xBpGgu1u4r9eSQdSxtUeB2AZyIdGp7l0asAoIiG2dG8M2w+hnRBtEQdXhAauE9eAmc + Lz8NipPzS1dpK7KmUJMewptR3yqFpjVToUrLu15+Sur/yBvdXj6qqTcdOR6N0/Cp9V + Gf2NouKDlwGem7DkmWYfXRj/UT+Vl8FlX2cXR/cKitUiPqvQWf6fux44kh5DpsOAX9 + RnIc/oaZAuzmH1MVV1aDK9m//ObHvaSyrpf+ARtbtDpfZUkywoV619Ooed5KIwISs4 + rCX+IAWuFq/4Q== +Cc: Tomi Ollila +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, 10 Feb 2014 18:42:19 -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 +