epsft-53 ~ $ emerge --sync emergelog(): [Errno 13] Permission denied: b'/var/log/emerge.log' -> b'/var/log/.emerge.log.hardlock-epsft-53-21489' emergelog(): [Errno 13] Permission denied: b'/var/log/emerge.log' -> b'/var/log/.emerge.log.hardlock-epsft-53-21489' emergelog(): [Errno 13] Permission denied: b'/var/log/emerge.log' -> b'/var/log/.emerge.log.hardlock-epsft-53-21489' * waiting for lock on /var/log/emerge.log ...^C Exiting on signal Signals.SIGINT emergelog(): [Errno 13] Permission denied: b'/var/log/emerge.log' -> b'/var/log/.emerge.log.hardlock-epsft-53-21489' Downgraded to portage-2.3.59, as that seems unaffected.
Some potentially relevant information is that I keep the main repo with permissions for my regular user: /etc/portage/repos.conf [DEFAULT] main-repo = gentoo [gentoo] priority = 1 location = /home/amadio/gentoo/gentoo sync-uri = git+ssh@git.gentoo.org/repo/gentoo.git clone-depth = 0 sync-type = git auto-sync = Yes
This EPERM error causes the emergelog function to leave the file descriptor open with the lock acquired.
Maybe it should skip the _lockfile_was_removed routine for the unlinkfile=0 case.
Simple fix: > --- a/lib/portage/locks.py > +++ b/lib/portage/locks.py > @@ -273,7 +273,7 @@ def lockfile(mypath, wantnewlockfile=0, unlinkfile=0, > > > if isinstance(lockfilename, basestring) and \ > - myfd != HARDLINK_FD and _lockfile_was_removed(myfd, lockfilename): > + myfd != HARDLINK_FD and unlinkfile and _lockfile_was_removed(myfd, lockfilename): > # The file was deleted on us... Keep trying to make one... > os.close(myfd) > writemsg(_("lockfile recurse\n"), 1)
Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/3b74211f8c1d8e635618c89504a50295 https://github.com/gentoo/portage/pull/411
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4b4da5d7e1cb1298cec0d8a01d94044f630b5a3a commit 4b4da5d7e1cb1298cec0d8a01d94044f630b5a3a Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2019-02-20 00:55:24 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2019-02-20 00:55:33 +0000 sys-apps/portage: version bump to 2.3.62 #678278 unprivileged sync emergelog lock permission denied Bug: https://bugs.gentoo.org/671498 Bug: https://bugs.gentoo.org/678278 Package-Manager: Portage-2.3.62, Repoman-2.3.12 Signed-off-by: Zac Medico <zmedico@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-2.3.62.ebuild | 271 +++++++++++++++++++++++++++++++++ 2 files changed, 272 insertions(+)
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=6b95678e23bf2b68bfd27d7c50777efc38fd4ea3 commit 6b95678e23bf2b68bfd27d7c50777efc38fd4ea3 Author: Zac Medico <zachary.medico@sony.com> AuthorDate: 2019-02-20 00:17:26 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2019-02-20 00:38:09 +0000 lockfile: do not leak file descriptor after _lockfile_was_removed exception Bug: https://bugs.gentoo.org/678278 Copyright: Sony Interactive Entertainment Inc. Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/locks.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) https://gitweb.gentoo.org/proj/portage.git/commit/?id=d192213dab5b55fba9d200daad1cb2dde763136e commit d192213dab5b55fba9d200daad1cb2dde763136e Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2019-02-19 07:51:07 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2019-02-19 07:54:39 +0000 locks: check for removed lockfile only if unlinkfile is True Check for a removed lockfile only if unlinkfile is True, since in this case the parent directory must be writable. This fixes emergelog usage where the parent directory is not writable. Bug: https://bugs.gentoo.org/678278 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/locks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
I just tried with portage-2.3.62 and the problem is gone. Thanks!
*** Bug 680000 has been marked as a duplicate of this bug. ***