From 0545b6a2ebeb4e668c98218418e66f447e96592c Mon Sep 17 00:00:00 2001 From: Thomas Waldmann Date: Sat, 2 Nov 2024 19:21:08 +0100 Subject: [PATCH] compress_entry: fix assertion failure if the size is not known yet in the chunks index, we must update the value there. --- src/borg/cache.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/borg/cache.py b/src/borg/cache.py index ed5c11c1e..d807472a0 100644 --- a/src/borg/cache.py +++ b/src/borg/cache.py @@ -397,7 +397,10 @@ def compress_entry(self, entry): cie = self.chunks.get(id) assert cie is not None assert cie.flags & ChunkIndex.F_USED - assert size == cie.size + if cie.size == 0: # size is not known in the chunks index yet + self.chunks[id] = cie._replace(size=size) + else: + assert size == cie.size, f"{size} != {cie.size}" idx = self.chunks.k_to_idx(id) compressed_chunks.append(idx) entry = entry._replace(chunks=compressed_chunks)