1 |
The lockfile function is expected to raise PermissionDenied if |
2 |
the (root) parent process holds the lock, so retry in this case. |
3 |
|
4 |
Bug: https://bugs.gentoo.org/468990 |
5 |
Signed-off-by: Zac Medico <zmedico@g.o> |
6 |
--- |
7 |
bin/ebuild-ipc.py | 11 ++++++++++- |
8 |
1 file changed, 10 insertions(+), 1 deletion(-) |
9 |
|
10 |
diff --git a/bin/ebuild-ipc.py b/bin/ebuild-ipc.py |
11 |
index 4999c043a..6eaa658a2 100755 |
12 |
--- a/bin/ebuild-ipc.py |
13 |
+++ b/bin/ebuild-ipc.py |
14 |
@@ -158,7 +158,16 @@ class EbuildIpc: |
15 |
# Make locks quiet since unintended locking messages displayed on |
16 |
# stdout could corrupt the intended output of this program. |
17 |
portage.locks._quiet = True |
18 |
- lock_obj = portage.locks.lockfile(self.ipc_lock_file, unlinkfile=True) |
19 |
+ # Acquire lock with PermissionDenied retry for bug #468990. |
20 |
+ for _ in range(1000): |
21 |
+ try: |
22 |
+ lock_obj = portage.locks.lockfile(self.ipc_lock_file, unlinkfile=True) |
23 |
+ except portage.exception.PermissionDenied: |
24 |
+ time.sleep(0.1) |
25 |
+ else: |
26 |
+ break |
27 |
+ else: |
28 |
+ raise portage.exception.PermissionDenied(self.ipc_lock_file) |
29 |
|
30 |
try: |
31 |
return self._communicate(args) |
32 |
-- |
33 |
2.32.0 |