diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-02-11 18:58:16 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-02-11 18:58:16 +0000 |
commit | b5fd1970cd00249c14256f08b2ad0d17d569674a (patch) | |
tree | 179fdb900e3d5d16398fb5dffe3328d8093c3f79 | |
parent | c9891910a8f7df878686a8be7e6d73adb66dd9c6 (diff) | |
download | portage-b5fd1970cd00249c14256f08b2ad0d17d569674a.tar.gz portage-b5fd1970cd00249c14256f08b2ad0d17d569674a.tar.bz2 portage-b5fd1970cd00249c14256f08b2ad0d17d569674a.zip |
try to be more forgiving if unlinking fails, because we end up in an unknown
state if we die right away, as demonstrated by darkside
(branches/prefix r15337)
svn path=/main/trunk/; revision=15338
-rw-r--r-- | pym/portage/dbapi/vartree.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 16f600683..a5d26c8ea 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -2454,6 +2454,18 @@ class dblink(object): # suid/sgid files are rendered harmless. os.chmod(file_name, 0) os.unlink(file_name) + except OSError as ose: + # If the chmod or unlink fails, you are in trouble. + # With Prefix this can be because the file is owned + # by someone else (a screwup by root?), on a normal + # system maybe filesystem corruption. In any case, + # if we backtrace and die here, we leave the system + # in a totally undefined state, hence we just bleed + # like hell and continue to hopefully finish all our + # administrative and pkg_postinst stuff. + showMessage(colorize("WARN", _("WARNING:")) + + " Could not chmod or unlink %s: %s\n" % (file_name, ose), + level=logging.WARN, noiselevel=-1) finally: if bsd_chflags and pflags != 0: # Restore the parent flags we saved before unlinking |