[Yum-devel] [PATCH] Report empty/invalid BZ2/GZ files.

Zdeněk Pavlas zpavlas at redhat.com
Wed Aug 29 12:57:04 UTC 2012


Aborted downloads result in empty/incomplete .bz2 files.
When we "uncompress" this to empty .sqlite, unrealated
sql errors pop up.
---
 yum/misc.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/yum/misc.py b/yum/misc.py
index 4cae42b..a39a222 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -759,10 +759,9 @@ def _decompress_chunked(source, dest, ztype):
     while True:
         try:
             data = s_fn.read(1024000)
-        except IOError:
-            break
-        except EOFError:
-            break
+        except (OSError, IOError, EOFError), e:
+            msg = "Error reading from file %s: %s" % (source, str(e))
+            raise Errors.MiscError, msg
         
         if not data: break
 
-- 
1.7.4.4



More information about the Yum-devel mailing list