]> arthur.barton.de Git - bup.git/commitdiff
cmd/save: if file.read() returns an error, don't abort.
authorAvery Pennarun <apenwarr@gmail.com>
Sat, 16 Oct 2010 23:55:16 +0000 (17:55 -0600)
committerAvery Pennarun <apenwarr@gmail.com>
Sat, 16 Oct 2010 23:57:53 +0000 (17:57 -0600)
Apparently some mis-implemented Linux filesystems (selinuxfs) have regular
files that can be opened for read, but return EINVAL when you try to read
them.  We would throw a fatal exception in that case (since we're not
supposed to have read errors ever, and thus that implies something happened
that we didn't think of) but I guess we'd better make this into a non-fatal
error.  It still makes the exit code nonzero so you can see that something
didn't work, though.

Reported by Zoran Zaric.

Signed-off-by: Avery Pennarun <apenwarr@gmail.com>
cmd/save-cmd.py

index 4477894fefa7035ede49a45d3c451a8cbe9784ee..c10c216c2274fbd9912597a91359ac579fc0fb59 100755 (executable)
@@ -241,7 +241,12 @@ for (transname,ent) in r.filter(extra, wantrecurse=wantrecurse_during):
                 add_error(e)
                 lastskip_name = ent.name
             else:
-                (mode, id) = hashsplit.split_to_blob_or_tree(w, [f], False)
+                try:
+                    (mode, id) = hashsplit.split_to_blob_or_tree(w, [f],
+                                            keep_boundaries=False)
+                except IOError, e:
+                    add_error('%s: %s' % (ent.name, e))
+                    lastskip_name = ent.name
         else:
             if stat.S_ISDIR(ent.mode):
                 assert(0)  # handled above