]> arthur.barton.de Git - bup.git/commit - lib/bup/metadata.py
Don't create ACL objects until they're needed.
authorRob Browning <rlb@defaultvalue.org>
Mon, 21 Oct 2013 20:57:40 +0000 (15:57 -0500)
committerRob Browning <rlb@defaultvalue.org>
Wed, 23 Oct 2013 20:23:36 +0000 (15:23 -0500)
commit68766ef404a0787314367aef7359ac48a984beaf
treec8ccc31135fde7c93f3f224e921536dfa5e059c8
parente9d4e4ae6e27d06cca5226e9bce2dc7f915e3780
Don't create ACL objects until they're needed.

Previously bup would store the POSIX1e ACL information in metadata
objects as pylibacl objects.  That meant bup would have to be able to
create those objects immediately when loading the metadata record.

Aside from being unnecessary, that was causing top-level crashes in
cases where the ACL object creation failed.  That's because bup would
throw an exception (deferred via add_error()) without skipping the ACL
metadata record content.  After that, all metadata reads would be out
of sync, resulting in erroneous reads, and an eventual EOFError.

To fix the problem, don't convert the encoded ACL data to pylibacl
objects until necessary (i.e. unless trying to apply the ACLs to the
filesystem via bup restore).  With that change bup should no longer
get out of sync when reading the metadata, and in cases where it would
be impossible to create the pylibacl objects (i.e. the local machine's
user/groups won't allow it), bup won't just drop the metadata.  For
example,

  bup meta --edit --set-user rlb < metadata.old > metadata.new

will no longer silently drop ACL information in metadata.old on error.

Thanks to Anton Eliasson <devel@antoneliasson.se> for reporting the
problem and helping track it down.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/metadata.py