commit: f90400eedc6a8788878c050880db564800c825d2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Fri Aug 23 20:00:15 2019 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sat Aug 24 02:41:35 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f90400ee
preserve-libs: ignore dropped non-soname symlink (bug 692698) Fix the dblink _find_libs_to_preserve method to ignore a dropped non-soname symlink. For example, pam-1.3.1-r1 drops the non-soname symlink named libpam_misc.so, and we don't want this to trigger unnecessary preservation of the corresponding library, since the corresponding libpam_misc.so.0 soname symlink and the hardlink that it references are still provided by pam-1.3.1-r1. Bug: https://bugs.gentoo.org/692698 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/portage/dbapi/vartree.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index 4f069474b..fa1e1523c 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -3133,10 +3133,6 @@ class dblink(object): os = portage.os f = f_abs[root_len:] - if not unmerge and self.isowner(f): - # We have an indentically named replacement file, - # so we don't try to preserve the old copy. - continue try: consumers = linkmap.findConsumers(f, exclude_providers=(installed_instance.isowner,)) @@ -3184,16 +3180,27 @@ class dblink(object): hardlinks = set() soname_symlinks = set() soname = linkmap.getSoname(next(iter(preserve_node.alt_paths))) + have_replacement_soname_link = False + have_replacement_hardlink = False for f in preserve_node.alt_paths: f_abs = os.path.join(root, f.lstrip(os.sep)) try: if stat.S_ISREG(os.lstat(f_abs).st_mode): hardlinks.add(f) + if not unmerge and self.isowner(f): + have_replacement_hardlink = True + if os.path.basename(f) == soname: + have_replacement_soname_link = True elif os.path.basename(f) == soname: soname_symlinks.add(f) + if not unmerge and self.isowner(f): + have_replacement_soname_link = True except OSError: pass + if have_replacement_hardlink and have_replacement_soname_link: + continue + if hardlinks: preserve_paths.update(hardlinks) preserve_paths.update(soname_symlinks)