I noticed these unused preserved libs after libreoffice-5.2.7.2 was automatically uninstalled following installation of libreoffice-bin-5.4.2.2: >>> Emerging binary (1 of 8) sys-libs/glibc-2.25-r8::gentoo >>> Installing (1 of 8) sys-libs/glibc-2.25-r8::gentoo >>> Emerging binary (2 of 8) app-text/libstaroffice-0.0.5::gentoo >>> Installing (2 of 8) app-text/libstaroffice-0.0.5::gentoo >>> Emerging binary (3 of 8) media-libs/libzmf-0.0.2::gentoo >>> Emerging binary (4 of 8) app-office/libreoffice-l10n-5.4.2.2::gentoo >>> Emerging binary (5 of 8) dev-libs/xmlsec-1.2.24-r1::gentoo >>> Emerging binary (6 of 8) dev-libs/libixion-0.12.2::gentoo >>> Installing (3 of 8) media-libs/libzmf-0.0.2::gentoo >>> Installing (4 of 8) app-office/libreoffice-l10n-5.4.2.2::gentoo >>> Installing (5 of 8) dev-libs/xmlsec-1.2.24-r1::gentoo >>> Installing (6 of 8) dev-libs/libixion-0.12.2::gentoo >>> Emerging binary (7 of 8) dev-libs/liborcus-0.12.1::gentoo >>> Installing (7 of 8) dev-libs/liborcus-0.12.1::gentoo >>> Emerging binary (8 of 8) app-office/libreoffice-bin-5.4.2.2::gentoo >>> Installing (8 of 8) app-office/libreoffice-bin-5.4.2.2::gentoo >>> Recording app-office/libreoffice-bin in "world" favorites file... >>> Uninstalling app-office/libreoffice-5.2.7.2::gentoo >>> Auto-cleaning packages... >>> No outdated packages were found on your system. * Regenerating GNU info directory index... * Processed 195 info files. !!! existing preserved libs: >>> package: dev-libs/liborcus-0.12.1 * - /usr/lib64/liborcus-parser-0.11.so.0 * - /usr/lib64/liborcus-parser-0.11.so.0.0.0 * - /usr/lib64/liborcus-0.11.so.0 * - /usr/lib64/liborcus-0.11.so.0.0.0 Use emerge @preserved-rebuild to rebuild packages using these libraries When I re-install the liborcus-0.12.1 binary package, the unused preserved libs are automatically removed.
It looks like the problem is that dblink.unmerge() calls self._prune_plib_registry() with no arguments, which then calls self._find_unused_preserved_libs(unmerge_no_replacement=False), but we really want unmerge_no_replacement=True behavior here.
The lib_graph inside _find_unused_preserved_libs shows that it's using NEEDED.ELF.2 data from the libreoffice-5.2.7.2, even though the files now belong to libreoffice-bin-5.4.2.2 (which depend on liborcus-*0.12.so.0): ['/usr/lib64/libreoffice/program/libsclo.so'] depends on ['/usr/lib64/liborcus-parser-0.11.so.0', '/usr/lib64/liborcus-parser-0.11.so.0.0.0'] (0) ['/usr/lib64/liborcus-parser-0.11.so.0', '/usr/lib64/liborcus-parser-0.11.so.0.0.0'] (no children) ['/usr/lib64/liborcus-0.11.so.0', '/usr/lib64/liborcus-0.11.so.0.0.0'] depends on ['/usr/lib64/liborcus-parser-0.11.so.0', '/usr/lib64/liborcus-parser-0.11.so.0.0.0'] (0) ['/usr/lib64/libreoffice/program/libscfiltlo.so'] depends on ['/usr/lib64/liborcus-parser-0.11.so.0', '/usr/lib64/liborcus-parser-0.11.so.0.0.0'] (0) ['/usr/lib64/liborcus-0.11.so.0', '/usr/lib64/liborcus-0.11.so.0.0.0'] (0) The files from libreoffice-bin-5.4.2.2 actually depend on liborcus-0.12.so.0
Patch posted for review: https://archives.gentoo.org/gentoo-portage-dev/message/f22ad57a6dd166073ab8643854174f32 https://github.com/gentoo/portage/pull/227
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=0936d873aedccfb46ca4353c0b52f460287d6682 commit 0936d873aedccfb46ca4353c0b52f460287d6682 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2017-11-13 02:11:07 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2017-11-14 03:14:19 +0000 vardbapi.removeFromContents: update NEEDED (bug 637284) When removing files from CONTENTS, also remove the corresponding lines from NEEDED, so that they do not corrupt LinkageMap data for preserve-libs. Bug: https://bugs.gentoo.org/637284 Reviewed-by: Manuel Rüger <mrueg@gentoo.org> pym/portage/dbapi/vartree.py | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-)}