Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] locks: check for removed lockfile only if unlinkfile is True
Date: Tue, 19 Feb 2019 08:00:33
Message-Id: 20190219075807.21537-1-zmedico@gentoo.org
1 Check for a removed lockfile only if unlinkfile is True, since
2 in this case the parent directory must be writable. This fixes
3 emergelog usage where the parent directory is not writable.
4
5 Bug: https://bugs.gentoo.org/678278
6 Signed-off-by: Zac Medico <zmedico@g.o>
7 ---
8 lib/portage/locks.py | 2 +-
9 1 file changed, 1 insertion(+), 1 deletion(-)
10
11 diff --git a/lib/portage/locks.py b/lib/portage/locks.py
12 index 510925da0..a23d5cb56 100644
13 --- a/lib/portage/locks.py
14 +++ b/lib/portage/locks.py
15 @@ -273,7 +273,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0,
16
17
18 if isinstance(lockfilename, basestring) and \
19 - myfd != HARDLINK_FD and _lockfile_was_removed(myfd, lockfilename):
20 + myfd != HARDLINK_FD and unlinkfile and _lockfile_was_removed(myfd, lockfilename):
21 # The file was deleted on us... Keep trying to make one...
22 os.close(myfd)
23 writemsg(_("lockfile recurse\n"), 1)
24 --
25 2.18.1