diff options
-rw-r--r-- | pym/_emerge/BlockerCache.py | 2 | ||||
-rw-r--r-- | pym/portage/dbapi/vartree.py | 2 | ||||
-rw-r--r-- | pym/portage/getbinpkg.py | 2 | ||||
-rw-r--r-- | pym/portage/util/_dyn_libs/PreservedLibsRegistry.py | 14 | ||||
-rw-r--r-- | pym/portage/util/mtimedb.py | 2 |
5 files changed, 14 insertions, 8 deletions
diff --git a/pym/_emerge/BlockerCache.py b/pym/_emerge/BlockerCache.py index 8a1c88478..007682823 100644 --- a/pym/_emerge/BlockerCache.py +++ b/pym/_emerge/BlockerCache.py @@ -59,7 +59,7 @@ class BlockerCache(portage.cache.mappings.MutableMapping): self._cache_data = mypickle.load() f.close() del f - except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: + except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: if isinstance(e, EnvironmentError) and \ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES): pass diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index 4df0576a4..3a6d99f02 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -555,7 +555,7 @@ class vardbapi(dbapi): aux_cache = mypickle.load() f.close() del f - except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: + except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: if isinstance(e, EnvironmentError) and \ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES): pass diff --git a/pym/portage/getbinpkg.py b/pym/portage/getbinpkg.py index a83e2a51c..3e5867223 100644 --- a/pym/portage/getbinpkg.py +++ b/pym/portage/getbinpkg.py @@ -542,7 +542,7 @@ def dir_get_metadata(baseurl, conn=None, chunk_size=3000, verbose=1, usingcache= out.write(_("Loaded metadata pickle.\n")) out.flush() metadatafile.close() - except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError): + except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError): metadata = {} if baseurl not in metadata: metadata[baseurl]={} diff --git a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py b/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py index a1814981d..510c390af 100644 --- a/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py +++ b/pym/portage/util/_dyn_libs/PreservedLibsRegistry.py @@ -59,12 +59,18 @@ class PreservedLibsRegistry(object): try: f = open(_unicode_encode(self._filename, encoding=_encodings['fs'], errors='strict'), 'rb') - self._data = pickle.load(f) - except (AttributeError, ValueError, pickle.UnpicklingError) as e: + if os.fstat(f.fileno()).st_size == 0: + # ignore empty lock file + pass + else: + self._data = pickle.load(f) + except (AttributeError, EOFError, ValueError, pickle.UnpicklingError) as e: writemsg_level(_("!!! Error loading '%s': %s\n") % \ (self._filename, e), level=logging.ERROR, noiselevel=-1) - except (EOFError, IOError) as e: - if isinstance(e, EOFError) or e.errno == errno.ENOENT: + except EnvironmentError as e: + if not hasattr(e, 'errno'): + raise + elif e.errno == errno.ENOENT: pass elif e.errno == PermissionDenied.errno: raise PermissionDenied(self._filename) diff --git a/pym/portage/util/mtimedb.py b/pym/portage/util/mtimedb.py index bc4f97c53..8079aa9ea 100644 --- a/pym/portage/util/mtimedb.py +++ b/pym/portage/util/mtimedb.py @@ -34,7 +34,7 @@ class MtimeDB(dict): d = mypickle.load() f.close() del f - except (AttributeError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: + except (AttributeError, EOFError, EnvironmentError, ValueError, pickle.UnpicklingError) as e: if isinstance(e, EnvironmentError) and \ getattr(e, 'errno', None) in (errno.ENOENT, errno.EACCES): pass |