From 1fb765887b4586f02c43330833832561c4986f1f Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Wed, 23 May 2007 17:20:32 +0000 Subject: [PATCH] Merged from trunk 6570:6580 +------------------------------------------------------------------------+ | 6570 | Fix size comparison logic. | | zmedico | | |---------+--------------------------------------------------------------| | 6571 | Handle a KeyError if an MTIME is missing from the Packages | | zmedico | index. | |---------+--------------------------------------------------------------| | 6579 | - cleaner version of the hardlink basic suid protection. | | solar | actually check that the file is setXid | |---------+--------------------------------------------------------------| | 6580 | Fix namespace for S_ISUID and S_ISGID. | | zmedico | | +------------------------------------------------------------------------+ svn path=/main/branches/prefix/; revision=6596 --- pym/portage/dbapi/bintree.py | 4 ++-- pym/portage/dbapi/vartree.py | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py index 9d9b84005..030f03163 100644 --- a/pym/portage/dbapi/bintree.py +++ b/pym/portage/dbapi/bintree.py @@ -412,9 +412,9 @@ class binarytree(object): skip = False if d: try: - if long(d.get("MTIME")) == long(s.st_mtime): + if long(d["MTIME"]) == long(s.st_mtime): skip = True - except ValueError: + except (KeyError, ValueError): pass if skip and not self._pkgindex_keys.difference(d): pkg_paths[mycpv] = mypath diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 640235801..6183785f3 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1211,11 +1211,12 @@ class dblink(object): writemsg_stdout("--- !md5 %s %s\n" % ("obj", obj)) continue try: - if statobj.st_nlink > 1: - portage.writemsg("There are "+str(st.st_nlink-1)+ \ - " hardlinks to '%s'\n" % obj) - # Always blind chmod 0 before unlinking to avoid race conditions. - os.chmod(obj, 0000) + if statobj.st_mode & (stat.S_ISUID | stat.S_ISGID): + # Always blind chmod 0 before unlinking to avoid race conditions. + os.chmod(obj, 0000) + if statobj.st_nlink > 1: + portage.writemsg("setXid: "+str(st.st_nlink-1)+ \ + " hardlinks to '%s'\n" % obj) os.unlink(obj) except (OSError, IOError), e: pass -- 2.26.2