mr-raj12
borg2 master (a586f6931): `compact_pack` and `transform_pack` drop a superseded duplicate (an object in a pack gap whose chunk id the index maps to another location) without checking that the indexed copy is readable. If that location is in a pack missing from the store or recorded corrupt, the dropped object can be the only intact copy of the chunk. - `superseded_gap_ranges` only compares the index entry's location with the gap object's location. - `borg compact` and `borg repo-compress` keep index entries that reference a missing pack ("borg check --repair removes them") and pass that index to `compact_pack` / `transform_pack`. - Same for an index entry pointing into a pack recorded corrupt in `cache/checked-packs`. Repro (unit level): 1. Pack A holds W, X, Y. Pack B holds a second copy of X, the index maps X to B, so X in A is a gap object. 2. Delete pack B from the store. W, X used, Y unused. 3. `borg compact` logs `index entries referencing a missing pack file: 1` and `1 of them are still in use: repository data is missing!`, then rewrites A (Y is unused) and drops X from it. 4. `repository.get(X)` raises `ObjectNotFound`. Before the compact, X was still in A. `borg repo-compress` drops it the same way: `transform_pack` drops superseded duplicates even if no object is recompressed. Proposal: pass the ids of the packs missing from the store and the packs recorded corrupt to `superseded_gap_ranges`; an index entry pointing into one of them does not make a gap object a superseded duplicate. Blocks #10471, which adds dropping whole packs of superseded duplicates.