mirror of
https://github.com/borgbackup/borg.git
synced 2025-02-24 23:13:25 +00:00
freebsd xattr namespace: str vs. bytes fixup
This commit is contained in:
parent
3e2393a058
commit
88b4a00d1b
1 changed files with 7 additions and 5 deletions
|
@ -323,7 +323,7 @@ def func(path, name, value, size):
|
|||
libc.extattr_set_file.argtypes = (c_char_p, c_int, c_char_p, c_char_p, c_size_t)
|
||||
libc.extattr_set_file.restype = c_int
|
||||
ns = EXTATTR_NAMESPACE_USER = 0x0001
|
||||
prefix = 'user.'
|
||||
prefix, prefix_b = 'user.', b'user.'
|
||||
|
||||
def listxattr(path, *, follow_symlinks=True):
|
||||
def func(path, buf, size):
|
||||
|
@ -350,8 +350,9 @@ def func(path, name, buf, size):
|
|||
|
||||
# strip namespace if there, but ignore if not there.
|
||||
# older borg / attic versions did not prefix the namespace to the names.
|
||||
if name.startswith(prefix):
|
||||
name = name[len(prefix):]
|
||||
_prefix = prefix if isinstance(name, str) else prefix_b
|
||||
if name.startswith(_prefix):
|
||||
name = name[len(_prefix):]
|
||||
n, buf = _getxattr_inner(func, path, name)
|
||||
return buf[:n] or None
|
||||
|
||||
|
@ -367,8 +368,9 @@ def func(path, name, value, size):
|
|||
|
||||
# strip namespace if there, but ignore if not there.
|
||||
# older borg / attic versions did not prefix the namespace to the names.
|
||||
if name.startswith(prefix):
|
||||
name = name[len(prefix):]
|
||||
_prefix = prefix if isinstance(name, str) else prefix_b
|
||||
if name.startswith(_prefix):
|
||||
name = name[len(_prefix):]
|
||||
_setxattr_inner(func, path, name, value)
|
||||
|
||||
else: # pragma: unknown platform only
|
||||
|
|
Loading…
Reference in a new issue