In __iter__, handle OSError from lstat in case a cache entry disappears.
authorZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 19:50:41 +0000 (19:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 2 Mar 2010 19:50:41 +0000 (19:50 -0000)
(trunk r15297)

svn path=/main/branches/2.1.7/; revision=15536

pym/portage/cache/flat_hash.py

index a010e5061ba057492887b8273cf40649d5fc3303..b014f170d5b6424015b3179fbce282ed87695122 100644 (file)
@@ -135,7 +135,11 @@ class database(fs_template.FsBased):
                                if l.endswith(".cpickle"):
                                        continue
                                p = os.path.join(dir_path, l)
-                               st = os.lstat(p)
+                               try:
+                                       st = os.lstat(p)
+                               except OSError:
+                                       # Cache entry disappeared.
+                                       continue
                                if stat.S_ISDIR(st.st_mode):
                                        # Only recurse 1 deep, in order to avoid iteration over
                                        # entries from another nested cache instance. This can