Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: Zac Medico <zmedico@g.o>, gentoo-portage-dev@l.g.o
Subject: [gentoo-portage-dev] Re: [PATCH] EbuildIpc.communicate: lockfile PermissionDenied retry
Date: Sun, 07 Nov 2021 04:58:23
Message-Id: b43199ca-d22c-a98e-6631-5007a45d71fe@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH] EbuildIpc.communicate: lockfile PermissionDenied retry by Zac Medico
1 On 11/3/21 20:09, Zac Medico wrote:
2 > The lockfile function is expected to raise PermissionDenied if
3 > the (root) parent process holds the lock, so retry in this case.
4 >
5 > Bug: https://bugs.gentoo.org/468990
6 > Signed-off-by: Zac Medico <zmedico@g.o>
7 > ---
8 > bin/ebuild-ipc.py | 11 ++++++++++-
9 > 1 file changed, 10 insertions(+), 1 deletion(-)
10 >
11 > diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py
12 > index 4999c043a..6eaa658a2 100755
13 > --- a/bin/ebuild-ipc.py
14 > +++ b/bin/ebuild-ipc.py
15 > @@ -158,7 +158,16 @@ class EbuildIpc:
16 > # Make locks quiet since unintended locking messages displayed on
17 > # stdout could corrupt the intended output of this program.
18 > portage.locks._quiet = True
19 > - lock_obj = portage.locks.lockfile(self.ipc_lock_file, unlinkfile=True)
20 > + # Acquire lock with PermissionDenied retry for bug #468990.
21 > + for _ in range(1000):
22 > + try:
23 > + lock_obj = portage.locks.lockfile(self.ipc_lock_file, unlinkfile=True)
24 > + except portage.exception.PermissionDenied:
25 > + time.sleep(0.1)
26 > + else:
27 > + break
28 > + else:
29 > + raise portage.exception.PermissionDenied(self.ipc_lock_file)
30 >
31 > try:
32 > return self._communicate(args)
33 >
34
35 Withdrawn in favor of this lockfile permission race fix:
36
37 https://archives.gentoo.org/gentoo-portage-dev/message/88916062415d9f692091dfb947f1bda2
38 --
39 Thanks,
40 Zac

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature