summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-09-28 00:15:57 +0000
committerZac Medico <zmedico@gentoo.org>2006-09-28 00:15:57 +0000
commita48676e03c940acb71fe015cf86b1a91f7e357bb (patch)
tree0bc0a32378bcd435085c4592124b5a9d1619f261
parentd477deeb1b02e403654c3d28794ef963406a8a2d (diff)
downloadportage-a48676e03c940acb71fe015cf86b1a91f7e357bb.tar.gz
portage-a48676e03c940acb71fe015cf86b1a91f7e357bb.tar.bz2
portage-a48676e03c940acb71fe015cf86b1a91f7e357bb.zip
Catch a ValueError caused by corrupt cache for bug #149134.
svn path=/main/trunk/; revision=4545
-rw-r--r--pym/cache/flat_hash.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/pym/cache/flat_hash.py b/pym/cache/flat_hash.py
index 1c687ecf3..722e9f184 100644
--- a/pym/cache/flat_hash.py
+++ b/pym/cache/flat_hash.py
@@ -36,7 +36,11 @@ class database(fs_template.FsBased):
raise KeyError(cpv)
def _parse_data(self, data, cpv):
- d = dict(map(lambda x:x.rstrip().split("=", 1), data))
+ try:
+ d = dict(map(lambda x:x.rstrip("\n").split("=", 1), data))
+ except ValueError, e:
+ # If a line is missing an "=", the split length is 1 instead of 2.
+ raise cache_errors.CacheCorruption(cpv, e)
if "_eclasses_" in d:
d["_eclasses_"] = reconstruct_eclasses(cpv, d["_eclasses_"])
return d