1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-23 00:07:38 +00:00

compress_entry: fix assertion failure

if the size is not known yet in the chunks index, we must update the value there.
This commit is contained in:
Thomas Waldmann 2024-11-02 19:21:08 +01:00
parent 59459af88b
commit 0545b6a2eb
No known key found for this signature in database
GPG key ID: 243ACFA951F78E01

View file

@ -397,7 +397,10 @@ def compress_entry(self, entry):
cie = self.chunks.get(id) cie = self.chunks.get(id)
assert cie is not None assert cie is not None
assert cie.flags & ChunkIndex.F_USED 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) idx = self.chunks.k_to_idx(id)
compressed_chunks.append(idx) compressed_chunks.append(idx)
entry = entry._replace(chunks=compressed_chunks) entry = entry._replace(chunks=compressed_chunks)