From 0f1b1f3e6883a09b187e8a917def810f6ae1d29d Mon Sep 17 00:00:00 2001 From: Peter Newcomb Date: Fri, 26 Nov 2021 08:04:26 -0500 Subject: [PATCH 1/2] avoid expanding path into LHS of formatting operation, see borgbackup#6063 --- src/borg/archive.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 0d9a49fa4..f398d43e8 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -778,7 +778,6 @@ Utilization of max. archive size: {csize_max:.0%} try: xattr.setxattr(fd or path, k, v, follow_symlinks=False) except OSError as e: - msg_format = '%s: when setting extended attribute %s: %%s' % (path, k.decode()) if e.errno == errno.E2BIG: err_str = 'too big for this filesystem' elif e.errno == errno.ENOTSUP: @@ -793,7 +792,7 @@ Utilization of max. archive size: {csize_max:.0%} # EACCES: permission denied to set this specific xattr (this may happen related to security.* keys) # EPERM: operation not permitted err_str = os.strerror(e.errno) - logger.warning(msg_format % err_str) + logger.warning('%s: when setting extended attribute %s: %s' % (path, k.decode(), err_str)) set_ec(EXIT_WARNING) # bsdflags include the immutable flag and need to be set last: if not self.nobsdflags and 'bsdflags' in item: From 550d17165f47e2f87195bfde1240de26fe7b0b2a Mon Sep 17 00:00:00 2001 From: Peter Newcomb Date: Sat, 27 Nov 2021 20:02:07 -0500 Subject: [PATCH 2/2] let the logger apply the args to the format string --- src/borg/archive.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index f398d43e8..0e7540f55 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -792,7 +792,7 @@ Utilization of max. archive size: {csize_max:.0%} # EACCES: permission denied to set this specific xattr (this may happen related to security.* keys) # EPERM: operation not permitted err_str = os.strerror(e.errno) - logger.warning('%s: when setting extended attribute %s: %s' % (path, k.decode(), err_str)) + logger.warning('%s: when setting extended attribute %s: %s', path, k.decode(), err_str) set_ec(EXIT_WARNING) # bsdflags include the immutable flag and need to be set last: if not self.nobsdflags and 'bsdflags' in item: