[Yum-devel] [PATCH] Emit non-pipe IOErrors properly and raise some semi-useful errors from bunzipFile

Seth Vidal skvidal at fedoraproject.org
Thu Aug 27 20:44:55 UTC 2009


when running out of space bunzipping a file  - if you hit an IOError it would just
kinda vanish. This is ultimately due to exIOError() in yummain.py but it would be good
to make a better error message so we know where the file is that had the error, etc

fixes rh bug https://bugzilla.redhat.com/show_bug.cgi?id=518720
and probably A LOT more that went away b/c someone ran 'yum clean all' and freed up the space
---
 yum/misc.py |    8 +++++++-
 yummain.py  |    2 ++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/yum/misc.py b/yum/misc.py
index ab92b78..68ab9e4 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -10,6 +10,7 @@ import base64
 import struct
 import re
 import errno
+import Errors
 import pgpmsg
 import tempfile
 import glob
@@ -629,8 +630,13 @@ def bunzipFile(source,dest):
             break
         
         if not data: break
-        destination.write(data)
 
+        try:
+            destination.write(data)
+        except (OSError, IOError), e:
+            msg = "Error writing to file %s: %s" % (dest, str(e))
+            raise Errors.MiscError, msg
+    
     destination.close()
     s_fn.close()
 
diff --git a/yummain.py b/yummain.py
index 281d0fc..964975b 100755
--- a/yummain.py
+++ b/yummain.py
@@ -46,6 +46,8 @@ def main(args):
     def exIOError(e):
         if e.errno == 32:
             logger.critical(_('\n\nExiting on Broken Pipe'))
+        else:
+            logger.critical(_('\n\n%s') % str(e))
         if unlock(): return 200
         return 1
 
-- 
1.6.2.5



More information about the Yum-devel mailing list