summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2012-11-20 20:38:32 -0800
committerZac Medico <zmedico@gentoo.org>2012-11-20 20:38:32 -0800
commit2694610b1fcd2818e203936bf663c9c44f4e6ca7 (patch)
treea7bc9a7d657e61787aac2a207a5e0494e5f89ca3
parent8f23cb8f32f8499575dc0629a8a83ddcf963d3c8 (diff)
downloadportage-2694610b1fcd2818e203936bf663c9c44f4e6ca7.tar.gz
portage-2694610b1fcd2818e203936bf663c9c44f4e6ca7.tar.bz2
portage-2694610b1fcd2818e203936bf663c9c44f4e6ca7.zip
flat_hash.__iter__: validate keys
-rw-r--r--pym/portage/cache/flat_hash.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/pym/portage/cache/flat_hash.py b/pym/portage/cache/flat_hash.py
index 2eae9f634..b71e118d5 100644
--- a/pym/portage/cache/flat_hash.py
+++ b/pym/portage/cache/flat_hash.py
@@ -13,6 +13,8 @@ from portage import os
from portage import _encodings
from portage import _unicode_decode
from portage import _unicode_encode
+from portage.exception import InvalidData
+from portage.versions import _pkg_str
if sys.hexversion >= 0x3000000:
long = int
@@ -135,8 +137,6 @@ class database(fs_template.FsBased):
del e
continue
for l in dir_list:
- if l.endswith(".cpickle"):
- continue
p = os.path.join(dir_path, l)
try:
st = os.lstat(p)
@@ -151,7 +151,11 @@ class database(fs_template.FsBased):
if depth < 1:
dirs.append((depth+1, p))
continue
- yield p[len_base+1:]
+
+ try:
+ yield _pkg_str(p[len_base+1:])
+ except InvalidData:
+ continue
class md5_database(database):