summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-03 13:39:37 +0100
committerDaniel Silverstone <daniel.silverstone@codethink.co.uk>2012-09-03 13:39:37 +0100
commit4c8eb31d86d88aa7f5f62570e7c7938f70338414 (patch)
tree74a04b27a50842250cb1b8d839d9b3cfbbbe5ab7
parent8ffd6f270ba32a15de93169fb71d2c76fc9d2305 (diff)
parentffea01c73732241742d804881377f537f282e5af (diff)
downloadmorph-4c8eb31d86d88aa7f5f62570e7c7938f70338414.tar.gz
Merge remote-tracking branch 'origin/liw/joe-ioerror-filenames'
-rw-r--r--morphlib/bins.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/morphlib/bins.py b/morphlib/bins.py
index ec750db1..00b0c2fc 100644
--- a/morphlib/bins.py
+++ b/morphlib/bins.py
@@ -116,8 +116,6 @@ def unpack_binary_from_file(f, dirname): # pragma: no cover
'''
- tf = tarfile.open(fileobj=f)
-
# This is evil, but necessary. For some reason Python's system
# call wrappers (os.mknod and such) do not (always?) set the
# filename attribute of the OSError exception they raise. We
@@ -177,16 +175,17 @@ def unpack_binary_from_file(f, dirname): # pragma: no cover
def make_something(tarinfo, targetpath): # pragma: no cover
prepare_extract(tarinfo, targetpath)
try:
- return real(tarinfo, targetpath)
- except OSError, e:
+ ret = real(tarinfo, targetpath)
+ except (IOError, OSError), e:
if e.errno != errno.EEXIST:
if e.filename is None:
e.filename = targetpath
- raise e
- else:
- raise
+ raise
+ else:
+ return ret
return make_something
+ tf = tarfile.open(fileobj=f, errorlevel=2)
tf.makedir = monkey_patcher(tf.makedir)
tf.makefile = monkey_patcher(tf.makefile)
tf.makeunknown = monkey_patcher(tf.makeunknown)