summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-05-05 04:50:23 +0000
committerZac Medico <zmedico@gentoo.org>2008-05-05 04:50:23 +0000
commit524bc877010dc4c7cc2d29617bd1edf57ade35f2 (patch)
tree4147d172415618f3c31d58469a15958cc303b3a9 /pym/portage.py
parent8e3e6a220313745818a79396b98ac0611d618e59 (diff)
downloadportage-524bc877010dc4c7cc2d29617bd1edf57ade35f2.tar.gz
portage-524bc877010dc4c7cc2d29617bd1edf57ade35f2.tar.bz2
portage-524bc877010dc4c7cc2d29617bd1edf57ade35f2.zip
Bug #220171 - Filter out 'lost+found' directories in vardbapi.cpv_all()
in order to avoid fatal 'Permission denied' errors. Currently, CVS and names beginning with '.' are also filtered. (trunk r10192) svn path=/main/branches/2.1.2/; revision=10193
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/portage.py b/pym/portage.py
index d7f4bbbd5..462363c91 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -6512,6 +6512,12 @@ class bindbapi(fakedbapi):
return fakedbapi.cpv_all(self)
class vardbapi(dbapi):
+
+ _excluded_dirs = ["CVS", "lost+found"]
+ _excluded_dirs = [re.escape(x) for x in _excluded_dirs]
+ _excluded_dirs = re.compile(r'^(\..*|' + \
+ "|".join(_excluded_dirs) + r')$')
+
"""
The categories parameter is unused since the dbapi class
now has a categories property that is generated from the
@@ -6711,10 +6717,12 @@ class vardbapi(dbapi):
returnme = []
basepath = os.path.join(self.root, VDB_PATH) + os.path.sep
for x in listdir(basepath, EmptyOnError=1, ignorecvs=1, dirsonly=1):
+ if self._excluded_dirs.match(x) is not None:
+ continue
if not self._category_re.match(x):
continue
for y in listdir(basepath+x,EmptyOnError=1):
- if y.startswith("."):
+ if self._excluded_dirs.match(y) is not None:
continue
subpath = x+"/"+y
# -MERGING- should never be a cpv, nor should files.