Re: [PATCH 3/7] odb/source-packed: flag known-bad objects as corrupt and not missing
Junio C Hamano <[email protected]>
| Newsgroups | org.kernel.vger.git |
|---|---|
| Message-ID | <[email protected]> |
Patrick Steinhardt <[email protected]> writes: > When reading a packed object that doesn't verify we mark it as bad and > indicate to the caller that we failed reading the object despite the > fact that it supposedly exists. This matches the semantics we have now > established in a preceding commit, where we discern failure to read a > corrupt object from a missing object. > > What doesn't work yet though is when a call tries to read an object that > has already been marked as corrupt in a previous call. In that case, > `find_pack_entry()` will tell us that the object in question does not > exist, and consequently we'll not flag the object as corrupt but as > missing. Thanks for attacking this one. I've always felt it awkward that we treat a corrupt/unreadable object as if we do not have it, and we even silently recover from it if we have another copy, making fsck practically the only thing that notices such breakages. > int fill_midx_entry(struct multi_pack_index *m, > const struct object_id *oid, > - struct pack_entry *e) > + struct pack_entry *e, > + struct packed_git **bad_pack) > { > uint32_t pos; > uint32_t pack_int_id; > @@ -618,8 +619,11 @@ int fill_midx_entry(struct multi_pack_index *m, > return 0; > > if (oidset_size(&p->bad_objects) && > - oidset_contains(&p->bad_objects, oid)) > + oidset_contains(&p->bad_objects, oid)) { > + if (bad_pack && !*bad_pack) > + *bad_pack = p; > return 0; > + } Hmph, so the idea is that if you have even one bad thing, you are marked as bad, because who knows what other parts of you are broken?