]> arthur.barton.de Git - bup.git/commitdiff
Catch errors when restoring Linux attrs into xfs or btrfs
authorYung-Chin Oei <yungchin@yungchin.nl>
Mon, 15 Apr 2013 14:34:08 +0000 (15:34 +0100)
committerRob Browning <rlb@defaultvalue.org>
Sat, 18 May 2013 15:13:02 +0000 (10:13 -0500)
Both xfs and btrfs turn out to return EOPNOTSUPP, rather than ENOTTY,
when we try to apply Linux attrs that they do not support.  This patch
improves matters in that it ensures we can restore into these file
systems without crashing, but does not quite address all issues yet:

- if any of the attributes we try to apply is not supported, none of
  them will be applied to the file at all
- the user will typically drown in error output; eg. for a backup
  originating from an ext4 file system, we can expect endless error
  output relating to the extents-flag not being supported on xfs/btrfs

Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/metadata.py

index 534988140c0d577b05416437ecc196a23240a4d4..27e1a2393ccf03edadd6f0493b71319e2c419e28 100644 (file)
@@ -562,7 +562,7 @@ class Metadata:
             try:
                 set_linux_file_attr(path, self.linux_attr)
             except OSError, e:
-                if e.errno == errno.ENOTTY:
+                if e.errno == errno.ENOTTY or e.errno == errno.EOPNOTSUPP:
                     raise ApplyError('Linux chattr: %s' % e)
                 else:
                     raise