]> arthur.barton.de Git - bup.git/commit
metadata: adjust our posix1e calls for python 3
authorRob Browning <rlb@defaultvalue.org>
Sat, 4 Jan 2020 18:52:55 +0000 (12:52 -0600)
committerRob Browning <rlb@defaultvalue.org>
Sun, 19 Jan 2020 17:46:10 +0000 (11:46 -0600)
commit78c8cdfb919b2688a005e76aae8d030086fc40fd
treee58fa42806884ee21a275e1788ab6ed9f81b2ee0
parent1c94d08bfe63510418d8cdf23affc5d7350d70b2
metadata: adjust our posix1e calls for python 3

Accommodate at pylibacl's argument requirements (at least 0.5.4).  It
looks like it allows bytes for the ACL() file argument, but not for
filedef:

  $ cmd/bup-python
  Python 3.7.5 (default, Oct 27 2019, 15:43:29)
  [GCC 9.2.1 20191022] on linux
  Type "help", "copyright", "credits" or "license" for more information.
  >>> import posix1e
  >>> posix1e.ACL(file=b'README.md')
  <posix1e.ACL object at 0x7fa7bd5cee70>
  >>> posix1e.ACL(file='README.md')
  <posix1e.ACL object at 0x7fa7bd5a8bb0>
  >>> posix1e.ACL(filedef=b'.')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: argument 5 must be str, not bytes

And it expects a string for the to_any_text() prefix argument, but
rquires bytes for the sparator:

  >>> posix1e.ACL(file='README.md').to_any_text(prefix=b'', separator='')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: argument 1 must be str, not bytes

  >>> posix1e.ACL(file='README.md').to_any_text(prefix='', separator='')
  Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
  TypeError: argument 2 must be a byte string of length 1, not str

  >>> posix1e.ACL(file='README.md').to_any_text(prefix='', separator=b'x')
  b'user::rw-xgroup::r--xother::---'

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