diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-05-05 04:44:30 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-05-05 04:44:30 +0000 |
commit | a24b6087fc59a0c9585001c219117e08a450e504 (patch) | |
tree | 96c3b98f00164224fba73bea660a6cf6882dcd32 | |
parent | f796aecb6d442f2ffb715a3883daae79fa838351 (diff) | |
download | portage-a24b6087fc59a0c9585001c219117e08a450e504.tar.gz portage-a24b6087fc59a0c9585001c219117e08a450e504.tar.bz2 portage-a24b6087fc59a0c9585001c219117e08a450e504.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.
svn path=/main/trunk/; revision=10192
-rw-r--r-- | pym/portage/dbapi/vartree.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index a72d0edca..6b22704f7 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -223,6 +223,12 @@ class LinkageMap(object): return rValue 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')$') + def __init__(self, root, categories=None, settings=None, vartree=None): """ The categories parameter is unused since the dbapi class @@ -443,10 +449,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. |