[PATCH 07/11] metadata: enc_sh the key and value in detailed_bytes xattrs (xstat)

0 views
Skip to first unread message

Rob Browning

unread,
Jun 6, 2026, 2:38:36 PM (3 days ago) Jun 6
to bup-...@googlegroups.com
Encode xattr key and value for the detailed_bytes linux-xattr field
via enc_sh since they're binary data. They'll remain a single line
since the control characters will be encoded.

Signed-off-by: Rob Browning <r...@defaultvalue.org>
Tested-by: Rob Browning <r...@defaultvalue.org>
---
lib/bup/metadata.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/bup/metadata.py b/lib/bup/metadata.py
index b45f0dd7..8903fc80 100644
--- a/lib/bup/metadata.py
+++ b/lib/bup/metadata.py
@@ -22,7 +22,7 @@ from bup.helpers import \
log,
mkdirp,
note_error)
-from bup.io import path_msg
+from bup.io import enc_sh, path_msg
from bup.pwdgrp import pwd_from_uid, pwd_from_name, grp_from_gid, grp_from_name
from bup.xstat import utime, lutime

@@ -1192,7 +1192,7 @@ def detailed_bytes(meta, fields = None):
result.append(b'linux-attr: %x' % meta.linux_attr)
if 'linux-xattr' in fields and meta.linux_xattr:
for name, value in meta.linux_xattr:
- result.append(b'linux-xattr: %s -> %s' % (name, value))
+ result.append(b'linux-xattr: %s -> %s' % (enc_sh(name), enc_sh(value)))
if 'posix1e-acl' in fields and meta.posix1e_acl:
acl = meta.posix1e_acl[0]
result.append(b'posix1e-acl: ' + acl + b'\n')
--
2.47.3

Reply all
Reply to author
Forward
0 new messages