summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-03-02 20:12:24 +0000
committerZac Medico <zmedico@gentoo.org>2010-03-02 20:12:24 +0000
commit4bb76a6f756edd25a42aae714b80ee61d5bf3266 (patch)
tree2f147705b92d786a2bc92a755515f98732c4f69d
parent8bce58d56d8ec75289188297d711a905ba43d2df (diff)
downloadportage-4bb76a6f756edd25a42aae714b80ee61d5bf3266.tar.gz
portage-4bb76a6f756edd25a42aae714b80ee61d5bf3266.tar.bz2
portage-4bb76a6f756edd25a42aae714b80ee61d5bf3266.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) (trunk r15338) svn path=/main/branches/2.1.7/; revision=15566
-rw-r--r--pym/portage/dbapi/vartree.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 990c6e020..cd16a4bca 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -1692,6 +1692,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