git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 3/7] odb/source-packed: flag known-bad objects as corrupt and not missing

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 18, 2026, 18:17 UTC
Message-ID
<xmqq5x17z41g.fsf@gitster.g>
In-Reply-To
<20260818-pks-odb-generic-corrupt-objects-v1-3-ec234567510f@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 11 quoted lines
> 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.

Show 18 quoted lines
>  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?

Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 9 of 18 in “odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` generically”
  1. 0/7 odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` genericallyPatrick Steinhardt, Aug 18, 2026
  2. 1/7 odb/source: discern missing and corrupt objectsPatrick Steinhardt, Aug 18, 2026
  3. Junio C HamanoAug 18, 2026
  4. Patrick SteinhardtAug 19, 2026
  5. 2/7 odb/source-inmemory: signal missing objects via positive returnPatrick Steinhardt, Aug 18, 2026
  6. Junio C HamanoAug 18, 2026
  7. Patrick SteinhardtAug 19, 2026
  8. 3/7 odb/source-packed: flag known-bad objects as corrupt and not missingPatrick Steinhardt, Aug 18, 2026
  9. Junio C HamanoAug 18, 2026
  10. Patrick SteinhardtAug 19, 2026
  11. Junio C HamanoAug 19, 2026
  12. 4/7 odb/source-loose: distinguish missing and corrupt objectsPatrick Steinhardt, Aug 18, 2026
  13. Junio C HamanoAug 18, 2026
  14. 5/7 odb/source-files: signal mark objects via positive returnPatrick Steinhardt, Aug 18, 2026
  15. Junio C HamanoAug 18, 2026
  16. Patrick SteinhardtAug 19, 2026
  17. 6/7 odb/source: allow `read_object_info()` to bubble up error messagesPatrick Steinhardt, Aug 18, 2026
  18. 7/7 odb: handle `OBJECT_INFO_DIE_IF_CORRUPT` genericallyPatrick Steinhardt, Aug 18, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.