Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 831927

Summary: sys-apps/portage - fails to create build-id symlinks when non-hardlinked files have the same build id
Product: Portage Development Reporter: Jonathan Callen <en.ABCD>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: sam
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://github.com/gentoo/portage/pull/786
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on: 837899    
Bug Blocks:    
Attachments: fake-example-1.0.ebuild

Description Jonathan Callen 2022-01-23 22:12:20 UTC
Created attachment 763417 [details]
fake-example-1.0.ebuild

When using FEATURES=splitdebug, if the same ELF is installed multiple times without using hard links or symlinks, Portage sometimes fails to create the build-id symlink to the file due to a TOCTTOU failure.

Attached is a sample ebuild that reliably causes this issue for me (make sure that MAKEOPTS is set to allow parallel builds).
Comment 2 Larry the Git Cow gentoo-dev 2022-02-04 17:32:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=d610d14325fbe65f9a011d643be74c95098c3241

commit d610d14325fbe65f9a011d643be74c95098c3241
Author:     Mike Gilbert <floppym@gentoo.org>
AuthorDate: 2022-02-02 18:07:19 +0000
Commit:     Mike Gilbert <floppym@gentoo.org>
CommitDate: 2022-02-02 18:11:29 +0000

    estrip: fix race when creating build-id debug symlinks
    
    Bug: https://bugs.gentoo.org/831927
    Closes: https://github.com/gentoo/portage/pull/786
    Signed-off-by: Mike Gilbert <floppym@gentoo.org>

 bin/estrip | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)