Subject: Re: [PATCH 4/4] pack-check: fix verification of large objects

From: Jeff King <[email-masked]>
Date: Mon, 23 Feb 2026 07:58:43 -0500

On Mon, Feb 23, 2026 at 12:30:35PM +0100, Patrick Steinhardt wrote:

> > A more concrete test would probably be something like:
> > 
> >    1. Two packs, $X and $Y, both contain the same object.
> > 
> >    2. The object is corrupt in $X but not in $Y.
> > 
> >    3. Running fsck detects that one copy is corrupt but the other is
> >       not.
> > 
> > Right now it may or may not fail depending on the ordering of the packs
> > in the MRU list (which we might be able to tweak via mtimes). But
> > hopefully in the "after" state it should deterministically complain
> > about $X.
> 
> Yeah. The problem I had here is that I'm not sure whether we have any
> tools to reliably create a corrupted object, e.g. with a hash mismatch.
> I'll have a look for v2.

You can see how do_corrupt_object() in t5303 does it. It's basically
finding an offset via show-index and then writing a zero over it with
dd.

-Peff