Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 678278 - >=sys-apps/portage-2.3.60: locks up on emerge --sync waiting on non-existent lock file
Summary: >=sys-apps/portage-2.3.60: locks up on emerge --sync waiting on non-existent ...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS, REGRESSION
: 680000 (view as bug list)
Depends on:
Blocks: 671498
  Show dependency tree
 
Reported: 2019-02-18 08:20 UTC by Guilherme Amadio
Modified: 2019-03-11 17:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guilherme Amadio gentoo-dev 2019-02-18 08:20:29 UTC
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.
Comment 1 Guilherme Amadio gentoo-dev 2019-02-18 08:22:47 UTC
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
Comment 2 Zac Medico gentoo-dev 2019-02-18 21:16:30 UTC
This EPERM error causes the emergelog function to leave the file descriptor open with the lock acquired.
Comment 3 Zac Medico gentoo-dev 2019-02-19 07:39:05 UTC
Maybe it should skip the _lockfile_was_removed routine for the unlinkfile=0 case.
Comment 4 Zac Medico gentoo-dev 2019-02-19 07:44:02 UTC
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)
Comment 6 Larry the Git Cow gentoo-dev 2019-02-20 00:57:33 UTC
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(+)
Comment 7 Larry the Git Cow gentoo-dev 2019-02-20 00:58:06 UTC
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(-)
Comment 8 Guilherme Amadio gentoo-dev 2019-02-21 13:44:41 UTC
I just tried with portage-2.3.62 and the problem is gone. Thanks!
Comment 9 Zac Medico gentoo-dev 2019-03-11 17:02:46 UTC
*** Bug 680000 has been marked as a duplicate of this bug. ***