public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] preserve-libs: ignore dropped non-soname symlink (bug 692698)
@ 2019-08-23 20:50 Zac Medico
  2019-08-24  1:17 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2019-08-23 20:50 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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.

Signed-off-by: Zac Medico <zmedico@gentoo.org>
---
 lib/portage/dbapi/vartree.py | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py
index 4f069474b..53c728066 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,25 @@ 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
 					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)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-portage-dev] [PATCH v2] preserve-libs: ignore dropped non-soname symlink (bug 692698)
  2019-08-23 20:50 [gentoo-portage-dev] [PATCH] preserve-libs: ignore dropped non-soname symlink (bug 692698) Zac Medico
@ 2019-08-24  1:17 ` Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2019-08-24  1:17 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

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@gentoo.org>
---
[PATCH v2] Prevent preservation of libnspr4.so hardlink reported
by Arfrever for dev-libs/nspr-4.21 to dev-libs/nspr-4.22 upgrade.

 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)
-- 
2.21.0



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-08-24  1:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-23 20:50 [gentoo-portage-dev] [PATCH] preserve-libs: ignore dropped non-soname symlink (bug 692698) Zac Medico
2019-08-24  1:17 ` [gentoo-portage-dev] [PATCH v2] " Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox