From a472460f7d93b83bbc8b8c08d48f0a57ab7924d3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 30 Jun 2011 03:01:06 -0700 Subject: [PATCH] LinkageMapELF.isMasterLink(): literally compare Comparing the lengths of the names alone seems like too much of an assumption, so literally compare the beginning of the soname to the basename of the given file. --- pym/portage/util/_dyn_libs/LinkageMapELF.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pym/portage/util/_dyn_libs/LinkageMapELF.py b/pym/portage/util/_dyn_libs/LinkageMapELF.py index 4b23421bb..d4c490cdb 100644 --- a/pym/portage/util/_dyn_libs/LinkageMapELF.py +++ b/pym/portage/util/_dyn_libs/LinkageMapELF.py @@ -481,7 +481,9 @@ class LinkageMapELF(object): def isMasterLink(self, obj): """ - Determine whether an object is a master link. + Determine whether an object is a "master" symlink, which means + that its basename is that same as the beginning part of the + soname and it lacks the soname's version component. @param obj: absolute path to an object @type obj: string (example: '/usr/bin/foo') @@ -492,12 +494,12 @@ class LinkageMapELF(object): """ os = _os_merge - basename = os.path.basename(obj) obj_key = self._obj_key(obj) if obj_key not in self._obj_properties: raise KeyError("%s (%s) not in object list" % (obj_key, obj)) + basename = os.path.basename(obj) soname = self._obj_properties[obj_key][3] - return (len(basename) < len(soname)) + return len(basename) < len(soname) and soname.startswith(basename) def listLibraryObjects(self): """ -- 2.26.2