From a4f7eeb1790890482971f8057873eab188fae9e5 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Thu, 7 Apr 2022 18:03:25 +0200 Subject: [PATCH] escape % chars in archive name, fixes #6500 also: fix percentage format for float value. --- src/borg/archive.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/borg/archive.py b/src/borg/archive.py index 728c76bb1..8234fc052 100644 --- a/src/borg/archive.py +++ b/src/borg/archive.py @@ -671,8 +671,10 @@ Utilization of max. archive size: {csize_max:.0%} archive_index = ChunkIndex() sync = CacheSynchronizer(archive_index) add(self.id) + # we must escape any % char in the archive name, because we use it in a format string, see #6500 + arch_name_escd = self.name.replace('%', '%%') pi = ProgressIndicatorPercent(total=len(self.metadata.items), - msg='Calculating statistics for archive %s ... %%3d%%%%' % self.name, + msg='Calculating statistics for archive %s ... %%3.0f%%%%' % arch_name_escd, msgid='archive.calc_stats') for id, chunk in zip(self.metadata.items, self.repository.get_many(self.metadata.items)): pi.show(increase=1)