diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-06-21 02:19:54 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-06-21 02:19:54 +0000 |
commit | c47cb48ef2be50f29bdc0861e8f6103e61680269 (patch) | |
tree | 6e0154154bccc4ab70f0fdc470158b0218cd4f40 | |
parent | 44b3d41705d8d62e1c1db588d508cfe59435663e (diff) | |
download | portage-c47cb48ef2be50f29bdc0861e8f6103e61680269.tar.gz portage-c47cb48ef2be50f29bdc0861e8f6103e61680269.tar.bz2 portage-c47cb48ef2be50f29bdc0861e8f6103e61680269.zip |
In dblink._security_check(), use os.path.realpath to make sure that the same path isn't counted twice.
svn path=/main/trunk/; revision=6894
-rw-r--r-- | pym/portage/dbapi/vartree.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 68545a53b..2c1e03694 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1506,6 +1506,7 @@ class dblink(object): for dblnk in installed_instances: file_paths.update(dblnk.getcontents()) inode_map = {} + real_paths = set() for path in file_paths: try: s = os.lstat(path) @@ -1514,8 +1515,13 @@ class dblink(object): raise del e continue - if stat.S_ISREG(s.st_mode) and \ - s.st_nlink > 1 and \ + if not stat.S_ISREG(s.st_mode): + continue + path = os.path.realpath(path) + if path in real_paths: + continue + real_paths.add(path) + if s.st_nlink > 1 and \ s.st_mode & (stat.S_ISUID | stat.S_ISGID): k = (s.st_dev, s.st_ino) inode_map.setdefault(k, []).append((path, s)) |