summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-06-10 03:33:13 +0000
committerZac Medico <zmedico@gentoo.org>2008-06-10 03:33:13 +0000
commita2e2efd80bcbb11f7265140fb79e32ff4af97dc8 (patch)
tree5cd96b83e736de3de834e5dac6d9545eafae1146
parent62b728b01d4bb6618d5b26f7cbee986ffb2750e5 (diff)
downloadportage-a2e2efd80bcbb11f7265140fb79e32ff4af97dc8.tar.gz
portage-a2e2efd80bcbb11f7265140fb79e32ff4af97dc8.tar.bz2
portage-a2e2efd80bcbb11f7265140fb79e32ff4af97dc8.zip
Add some sanity checks and error tolerance in the owners cache.
(trunk r10633) svn path=/main/branches/2.1.2/; revision=10634
-rw-r--r--pym/portage.py16
1 files changed, 15 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 045fa1eaa..3d65c1341 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -7099,6 +7099,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 = {
@@ -7465,8 +7467,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