[PATCH 2 of 4 STABLE] lock: avoid unintentional lock acquisition at failure of readlock
Yuya Nishihara
yuya at tcha.org
Sun Apr 30 08:42:34 EDT 2017
On Sat, 29 Apr 2017 17:38:08 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1493454422 -32400
> # Sat Apr 29 17:27:02 2017 +0900
> # Branch stable
> # Node ID d1bf658c4ea6d1f87328884bc00f2b91d884a6d9
> # Parent 7cb8ebcca7d3a542031c41e09dc3ca0e2db36dcc
> lock: avoid unintentional lock acquisition at failure of readlock
> diff --git a/mercurial/lock.py b/mercurial/lock.py
> --- a/mercurial/lock.py
> +++ b/mercurial/lock.py
> @@ -148,6 +148,12 @@ class lock(object):
> raise error.LockUnavailable(why.errno, why.strerror,
> why.filename, self.desc)
>
> + if not self.held:
> + # use 0 to mean "busy for frequent lock/unlock by many processes"
> + locker = "%s:%d" % (lock._host, 0)
> + raise error.LockHeld(errno.EAGAIN,
> + self.vfs.join(self.f), self.desc, locker)
I hesitate to use pid=0 as a null value. It's sometimes dangerous though it
would be okay here.
More information about the Mercurial-devel
mailing list