Index: pym/portage.py =================================================================== --- pym/portage.py (revision 6848) +++ pym/portage.py (revision 6853) @@ -7158,13 +7158,16 @@ writemsg_stdout("--- cfgpro %s %s\n" % (pkgfiles[objkey][0], obj)) continue + # Don't unlink symlinks to directories here since that can + # remove /lib and /usr/lib symlinks. if unmerge_orphans and \ lstatobj and not stat.S_ISDIR(lstatobj.st_mode) and \ + not (islink and statobj and stat.S_ISDIR(statobj.st_mode)) and \ not self.isprotected(obj): try: # Remove permissions to ensure that any hardlinks to # suid/sgid files are rendered harmless. - if statobj: + if statobj and not islink: os.chmod(obj, 0) os.unlink(obj) except EnvironmentError, e: @@ -7186,6 +7189,11 @@ if not islink: writemsg_stdout("--- !sym %s %s\n" % ("sym", obj)) continue + # Don't unlink symlinks to directories here since that can + # remove /lib and /usr/lib symlinks. + if statobj and stat.S_ISDIR(statobj.st_mode): + writemsg_stdout("--- !sym %s %s\n" % ("sym", obj)) + continue try: os.unlink(obj) writemsg_stdout("<<< %s %s\n" % ("sym",obj))