Explorar o código

Merge pull request #6064 from petenewcomb/1.1-maint

avoid expanding path into LHS of formatting operation, see #6063
TW %!s(int64=3) %!d(string=hai) anos
pai
achega
f0efd4fad6
Modificáronse 1 ficheiros con 1 adicións e 2 borrados
  1. 1 2
      src/borg/archive.py

+ 1 - 2
src/borg/archive.py

@@ -778,7 +778,6 @@ Utilization of max. archive size: {csize_max:.0%}
                 try:
                 try:
                     xattr.setxattr(fd or path, k, v, follow_symlinks=False)
                     xattr.setxattr(fd or path, k, v, follow_symlinks=False)
                 except OSError as e:
                 except OSError as e:
-                    msg_format = '%s: when setting extended attribute %s: %%s' % (path, k.decode())
                     if e.errno == errno.E2BIG:
                     if e.errno == errno.E2BIG:
                         err_str = 'too big for this filesystem'
                         err_str = 'too big for this filesystem'
                     elif e.errno == errno.ENOTSUP:
                     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)
                         # EACCES: permission denied to set this specific xattr (this may happen related to security.* keys)
                         # EPERM: operation not permitted
                         # EPERM: operation not permitted
                         err_str = os.strerror(e.errno)
                         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)
                     set_ec(EXIT_WARNING)
         # bsdflags include the immutable flag and need to be set last:
         # bsdflags include the immutable flag and need to be set last:
         if not self.nobsdflags and 'bsdflags' in item:
         if not self.nobsdflags and 'bsdflags' in item: