From 4f4be2631abc5fad97407cc0a4f05bf659a08a12 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 17 Sep 2022 20:29:34 +0200 Subject: [PATCH] check: fix uninitialised variable if repo is completely empty, fixes #7034 --- src/borg/repository.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/borg/repository.py b/src/borg/repository.py index 814f9b03b..56c846480 100644 --- a/src/borg/repository.py +++ b/src/borg/repository.py @@ -1027,6 +1027,7 @@ class Repository: t_start = time.monotonic() pi = ProgressIndicatorPercent(total=segment_count, msg='Checking segments %3.1f%%', step=0.1, msgid='repository.check') + segment = -1 # avoid uninitialized variable if there are no segment files at all for i, (segment, filename) in enumerate(self.io.segment_iterator()): pi.show(i) if segment <= last_segment_checked: