summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-10 03:31:30 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-10 03:31:30 +0000
commit2ac358954ea1f4a314b63fd765db58aad14689fc (patch)
tree5f463575ed32548735f1d1d31f5bbbc82935abd7
parent594bd45085f2e32f2dfb3c463a8ee8e56c2c1779 (diff)
downloadportage-2ac358954ea1f4a314b63fd765db58aad14689fc.tar.gz
portage-2ac358954ea1f4a314b63fd765db58aad14689fc.tar.bz2
portage-2ac358954ea1f4a314b63fd765db58aad14689fc.zip
Add some sanity checks and error tolerance in the owners cache.v2.2_pre8
svn path=/main/trunk/; revision=10633
-rw-r--r--pym/portage/dbapi/vartree.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index 4c67dfa05..190157b88 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -619,6 +619,8 @@ class vardbapi(dbapi):
owners = None
elif "base_names" not in owners:
owners = None
+ elif not isinstance(owners["base_names"], dict):
+ owners = None
if owners is None:
owners = {
@@ -994,8 +996,20 @@ class vardbapi(dbapi):
pkgs = base_names.get(name_hash)
if pkgs is not None:
for hash_value in pkgs:
+ try:
+ if len(hash_value) != 3:
+ continue
+ except TypeError:
+ continue
cpv, counter, mtime = hash_value
- if hash_pkg(cpv) != hash_value:
+ if not isinstance(cpv, basestring):
+ continue
+ try:
+ current_hash = hash_pkg(cpv)
+ except KeyError:
+ continue
+
+ if current_hash != hash_value:
continue
if dblink(cpv).isowner(path, root):
yield dblink(cpv), path