]> arthur.barton.de Git - bup.git/commitdiff
metadata: don't modify ACL list when writing
authorJohannes Berg <johannes@sipsolutions.net>
Sat, 30 May 2020 19:41:10 +0000 (21:41 +0200)
committerRob Browning <rlb@defaultvalue.org>
Fri, 19 Jun 2020 22:50:38 +0000 (17:50 -0500)
ACLs should be stored as a two-entry list on files, and four-entry
list for directories. Unfortunately, when writing, we expand the
two-entry list for files to four, because the metadata format is
always with four entries.

However, on reading, we trim the last two empty entries, so that
we can end up in an inconsistent situation: On a metadata entry
for a file that has been written already, it will still have four
entries, and that won't compare correctly etc.

This isn't an issue today because we only ever do the compare
in restore, where we didn't load from disk but from the meta-
data in the repository, which always starts out four entries.

Still, fix the inconsistency and don't erroneously extend the
list when writing.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Reviewed-by: Rob Browning <rlb@defaultvalue.org>
lib/bup/metadata.py

index d5b4b4ac30e902148c27fa45f27c64508daa1d7b..da79dc24b7bad57bca1decdf25c08f5f2128c385 100644 (file)
@@ -558,7 +558,7 @@ class Metadata:
         if self.posix1e_acl:
             acls = self.posix1e_acl
             if len(acls) == 2:
-                acls.extend([b'', b''])
+                return vint.pack('ssss', acls[0], acls[1], b'', b'')
             return vint.pack('ssss', acls[0], acls[1], acls[2], acls[3])
         else:
             return None