summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2012-12-23 19:53:11 +0000
committerLars Wirzenius <liw@liw.fi>2012-12-23 19:53:11 +0000
commit3b760105acd493d15ad7aa0a82d5bb6272517ac7 (patch)
treed1568cb43fbd9998f9d1ef26a331b1045f9bef5a
parent4ffb4565e6b003a08f3e45ecb1656443a63ad490 (diff)
downloadobnam-3b760105acd493d15ad7aa0a82d5bb6272517ac7.tar.gz
Fix crash when failing to restore extended attributes
Reported-By: S. B.
-rw-r--r--NEWS2
-rw-r--r--obnamlib/plugins/restore_plugin.py9
2 files changed, 10 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index e2fe90d1..34677b90 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,8 @@ Bug fixes:
* A bug in handling stat lookup errors was fixed. Reported by
Peter Palfrader. Symptom: `AttributeError: 'exceptions.OSError'
object has no attribute 'st_ino'` in an error message or log file.
+* A bug in a restore crashing when failing to set extended attributes
+ on the restored file was fixed. Reported by "S. B.".
Version 1.3, released 2012-12-16
--------------------------------
diff --git a/obnamlib/plugins/restore_plugin.py b/obnamlib/plugins/restore_plugin.py
index 2e08dc91..e95b4e0c 100644
--- a/obnamlib/plugins/restore_plugin.py
+++ b/obnamlib/plugins/restore_plugin.py
@@ -157,7 +157,14 @@ class RestorePlugin(obnamlib.ObnamPlugin):
else:
self.restore_first_link(gen, pathname, metadata)
if set_metadata and self.write_ok:
- obnamlib.set_metadata(self.fs, './' + pathname, metadata)
+ try:
+ obnamlib.set_metadata(self.fs, './' + pathname, metadata)
+ except (IOError, OSError), e:
+ msg = ('Could not set metadata: %s: %d: %s' %
+ (pathname, e.errno, e.strerror))
+ logging.error(msg)
+ self.app.ts.notify(msg)
+ self.errors = True
def restore_dir(self, gen, root, metadata):
logging.debug('restoring dir %s' % root)