Skip to content

Commit

Permalink
compress_entry: fix assertion failure
Browse files Browse the repository at this point in the history
if the size is not known yet in the chunks index, we must update the value there.
  • Loading branch information
ThomasWaldmann committed Nov 2, 2024
1 parent 59459af commit 0545b6a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/borg/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check warning on line 401 in src/borg/cache.py

View check run for this annotation

Codecov / codecov/patch

src/borg/cache.py#L401

Added line #L401 was not covered by tests
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)
Expand Down

0 comments on commit 0545b6a

Please sign in to comment.