Fix cacheddir() to behave properly if os.listdir() raises errno.EACCES (Permission...
authorZac Medico <zmedico@gentoo.org>
Tue, 19 Jun 2007 22:02:26 +0000 (22:02 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 19 Jun 2007 22:02:26 +0000 (22:02 -0000)
svn path=/main/branches/2.1.2/; revision=6880

pym/portage.py

index 7558a7b82bae53ea9dd52b619dc005884d9af323..ea3fba2fa2b7493d0ee449f4a66f4627df235700 100644 (file)
@@ -193,7 +193,15 @@ def cacheddir(my_original_path, ignorecvs, ignorelist, EmptyOnError, followSymli
        if mtime != cached_mtime or time.time() - mtime < 4:
                if dircache.has_key(mypath):
                        cacheStale += 1
-               list = os.listdir(mypath)
+               try:
+                       list = os.listdir(mypath)
+               except EnvironmentError, e:
+                       if e.errno != errno.EACCES:
+                               raise
+                       del e
+                       if EmptyOnError:
+                               return [], []
+                       raise portage_exception.PermissionDenied(mypath)
                ftype = []
                for x in list:
                        try: