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

Bug 642672

Summary: sys-apps/portage: deleting and reinstalling a package fails (sometime) when two needed libraries with the same name are kept
Product: Gentoo Linux Reporter: Tupone Alfredo <tupone>
Component: Current packagesAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: esigra
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 240323, 645194    
Attachments: preserved_libs_registry
PreservedLibsRegistry: fix pruneNonExisting for symlinks to other dirs
PreservedLibsRegistry: fix pruneNonExisting for symlinks to other dirs

Description Tupone Alfredo gentoo-dev 2017-12-29 20:48:22 UTC
When I do emerge -C of a package that have shared libraries needed by someone, those libraries are kept. If I emerge back the same package those libraries are substituted without any error.

On many of dev-ada/* packages there are symlink on the /usr/lib directory that point to the true file that is in a subdirectory. During removal of the package both symlink and true file are kept, but emerging back the package portage warns (or error out) saying that the symlinks are not owned by anyone
Comment 1 Zac Medico gentoo-dev 2017-12-29 21:42:31 UTC
Please attach a copy of /var/lib/portage/preserved_libs_registry from immediately after the package is unmerged.
Comment 2 Tupone Alfredo gentoo-dev 2017-12-30 08:04:18 UTC
Created attachment 512022 [details]
preserved_libs_registry

I did a cat of the file just before the end of the unmerging and I got 
{
    "dev-ada/xmlada:0": [
        "dev-ada/xmlada-2017", 
        "7001", 
        [
            "/usr/lib/libxmlada_dom.so.18.0w", 
            "/usr/lib/xmlada/xmlada_dom.relocatable/libxmlada_dom.so.18.0w", 
            "/usr/lib/libxmlada_input_sources.so.18.0w", 
            "/usr/lib/xmlada/xmlada_sax.relocatable/libxmlada_sax.so.18.0w", 
            "/usr/lib/libxmlada_sax.so.18.0w", 
            "/usr/lib/xmlada/xmlada_schema.relocatable/libxmlada_schema.so.18.0w", 
            "/usr/lib/libxmlada_unicode.so.18.0w", 
            "/usr/lib/libxmlada_schema.so.18.0w", 
            "/usr/lib/xmlada/xmlada_input.relocatable/libxmlada_input_sources.so.18.0w", 
            "/usr/lib/xmlada/xmlada_unicode.relocatable/libxmlada_unicode.so.18.0w"
        ]
    ]
}

The attached file is instead the final one
Comment 3 Zac Medico gentoo-dev 2018-01-02 08:55:12 UTC
This code from bug 406837 removes the symlinks from the preserved_libs_registry:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=32d19be14e22ada479963ba8627452f5f2d89b94
Comment 4 Zac Medico gentoo-dev 2018-01-02 09:23:03 UTC
Created attachment 512698 [details, diff]
PreservedLibsRegistry: fix pruneNonExisting for symlinks to other dirs

This patch should fix it. You can apply the patch by saving it in /etc/portage/patches/sys-apps/portage/ and rebuilding portage.
Comment 5 Zac Medico gentoo-dev 2018-01-02 13:24:12 UTC
Created attachment 512714 [details, diff]
PreservedLibsRegistry: fix pruneNonExisting for symlinks to other dirs

Add missing import.
Comment 6 Tupone Alfredo gentoo-dev 2018-01-02 22:09:17 UTC
This patch fix my problem. Thanks
Comment 7 Larry the Git Cow gentoo-dev 2018-01-02 23:04:52 UTC
The bug has been referenced in the following commit(s):

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

commit b9fc8e55f96c17aeece87387226ada1b184d2f77
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-01-02 09:09:34 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-01-02 23:02:39 +0000

    PreservedLibsRegistry: fix pruneNonExisting for symlinks to other dirs (bug 642672)
    
    Fix pruneNonExisting to use the abssymlink function to detect symlinks
    in the registry that no longer point to a preserved library. The previous
    code only worked correctly for symlinks pointing to files in the same
    directory, which failed for packages like dev-ada/xmlada which have
    symlinks that point into a subdirectory.
    
    Fixes: 32d19be14e22 ("pruneNonExisting: handle eselect-opengl symlinks")
    Tested-by: Tupone Alfredo <tupone@gentoo.org>
    Bug: https://bugs.gentoo.org/642672

 pym/portage/util/_dyn_libs/PreservedLibsRegistry.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)}
Comment 8 Zac Medico gentoo-dev 2018-01-02 23:06:04 UTC
Thanks for confirmation!