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

Bug 516016

Summary: QA check for shared libraries lacking NEEDED entries should not detect libraries actually not requiring any other libraries
Product: Portage Development Reporter: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Component: Core - Ebuild SupportAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: fturco, pacho
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 686768    
Attachments: Patch
Patch
Patch
Patch
DT_NEEDED_libraries_test-0.ebuild

Description Arfrever Frehtes Taifersar Arahesis 2014-07-01 18:34:37 UTC
Some packages install shared libraries, which contain only some data and do not use any symbols from any other libraries.

QA check in Portage (bin/misc-functions.sh:install_qa_check) should not detect such libraries.

I think that the solution might be to try to link a simple executable (e.g. "int main(int argc, char** argv){}") with any library detected with current algorithm and report QA notice only for libraries, with whom linking fails.
Comment 1 Arfrever Frehtes Taifersar Arahesis 2019-05-10 00:38:18 UTC
Actually parsing 'nm -D' should be easier.
If 'nm -D ${library} | grep -E "^ +U "' is empty, then given library should not be reported.
Comment 2 Arfrever Frehtes Taifersar Arahesis 2019-05-10 00:39:49 UTC
*** Bug 685364 has been marked as a duplicate of this bug. ***
Comment 3 Arfrever Frehtes Taifersar Arahesis 2019-05-10 01:24:33 UTC
Created attachment 575624 [details, diff]
Patch
Comment 4 Arfrever Frehtes Taifersar Arahesis 2019-05-10 04:17:39 UTC
Created attachment 575626 [details, diff]
Patch

(Fix for "nm: '': No such file")
Comment 5 Arfrever Frehtes Taifersar Arahesis 2019-05-10 04:19:33 UTC
Created attachment 575628 [details, diff]
Patch
Comment 6 Zac Medico gentoo-dev 2019-05-20 03:22:12 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #5)
> Created attachment 575628 [details, diff] [details, diff]
> Patch

Looks good, except I suppose we should use ${CHOST}-nm if found, like we do for other binutils programs inside bin/estrip.
Comment 7 Arfrever Frehtes Taifersar Arahesis 2019-05-20 04:02:01 UTC
Created attachment 577342 [details, diff]
Patch
Comment 8 Arfrever Frehtes Taifersar Arahesis 2019-05-20 04:56:16 UTC
Created attachment 577344 [details]
DT_NEEDED_libraries_test-0.ebuild

Ebuild allowing easy testing.
Libraries with even numbers have no NEEDED entries.

"""
 * QA Notice: The following shared libraries lack NEEDED entries
 * /usr/lib64/libtest04.so
 * /usr/lib64/libtest06.so
"""

libtest02.so might seem like it should also be reported, but apparently call to printf() is optimized away by compiler...
Comment 9 Larry the Git Cow gentoo-dev 2019-05-20 05:01:49 UTC
The bug has been referenced in the following commit(s):

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

commit e54bc64a3779d4546b70a7a82d677a18d3c37b67
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
AuthorDate: 2019-05-10 01:20:14 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2019-05-20 04:53:48 +0000

    install-qa-check.d/80libraries: fix false positive
    
    Do not report libraries missing DT_NEEDED and not containing undefined
    non-weak symbols.
    
    Bug: https://bugs.gentoo.org/516016
    Signed-off-by: Arfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 bin/install-qa-check.d/80libraries | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)