Merged from trunk 6570:6580
authorFabian Groffen <grobian@gentoo.org>
Wed, 23 May 2007 17:20:32 +0000 (17:20 -0000)
committerFabian Groffen <grobian@gentoo.org>
Wed, 23 May 2007 17:20:32 +0000 (17:20 -0000)
   +------------------------------------------------------------------------+
   | 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
pym/portage/dbapi/vartree.py

index 9d9b8400500bccbda2f9eefaee7b9d7589e5acde..030f03163bd77a436ac679cb7f0ca610d7ff9734 100644 (file)
@@ -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
index 6402358017d5212ef1a90449cb7e4d6817ae96e7..6183785f3cc10c81e180e1ee26cae4e7bb6f941c 100644 (file)
@@ -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