From b0b2ebb6ed06aa34f60ca0aaaafbab2f1f73b791 Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Wed, 6 Jul 2016 23:10:04 +0200 Subject: [PATCH] fixup: only create chunks_healthy if we actually replaced chunks --- borg/archive.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/borg/archive.py b/borg/archive.py index 12f11da3e..3cc9c2c22 100644 --- a/borg/archive.py +++ b/borg/archive.py @@ -919,11 +919,12 @@ class ArchiveChecker: """ offset = 0 chunk_list = [] + chunks_replaced = False for chunk_id, size, csize in item[b'chunks']: if chunk_id not in self.chunks: # If a file chunk is missing, create an all empty replacement chunk logger.error('{}: Missing file chunk detected (Byte {}-{})'.format(item[b'path'].decode('utf-8', 'surrogateescape'), offset, offset + size)) - self.error_found = True + self.error_found = chunks_replaced = True data = bytes(size) chunk_id = self.key.id_hash(data) cdata = self.key.encrypt(data) @@ -933,7 +934,7 @@ class ArchiveChecker: add_reference(chunk_id, size, csize) chunk_list.append((chunk_id, size, csize)) offset += size - if b'chunks_healthy' not in item: + if chunks_replaced and b'chunks_healthy' not in item: # if this is first repair, remember the correct chunk IDs, so we can maybe heal the file later item[b'chunks_healthy'] = item[b'chunks'] item[b'chunks'] = chunk_list