summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2011-06-30 03:01:06 -0700
committerZac Medico <zmedico@gentoo.org>2011-06-30 03:01:06 -0700
commita472460f7d93b83bbc8b8c08d48f0a57ab7924d3 (patch)
treed42491bba3cbcac5ab139efc52ad7a80d5d1749a
parente033be0c91e5776b3eef31a02aed849696e73f45 (diff)
downloadportage-a472460f7d93b83bbc8b8c08d48f0a57ab7924d3.tar.gz
portage-a472460f7d93b83bbc8b8c08d48f0a57ab7924d3.tar.bz2
portage-a472460f7d93b83bbc8b8c08d48f0a57ab7924d3.zip
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.
-rw-r--r--pym/portage/util/_dyn_libs/LinkageMapELF.py8
1 files 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):
"""