All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org,
	"brian m. carlson" <sandals@crustytoothpaste.net>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 4/4] pack-check: fix verification of large objects
Date: Mon, 23 Feb 2026 12:30:35 +0100	[thread overview]
Message-ID: <aZw6W_BHoYiC9RYl@pks.im> (raw)
In-Reply-To: <20260223111120.GC215364@coredump.intra.peff.net>

On Mon, Feb 23, 2026 at 06:11:20AM -0500, Jeff King wrote:
> On Mon, Feb 23, 2026 at 10:50:43AM +0100, Patrick Steinhardt wrote:
> 
> > diff --git a/pack-check.c b/pack-check.c
> > index 46782a29d5..6149567060 100644
> > --- a/pack-check.c
> > +++ b/pack-check.c
> > @@ -155,7 +155,7 @@ static int verify_packfile(struct repository *r,
> >  			err = error("packed %s from %s is corrupt",
> >  				    oid_to_hex(&oid), p->pack_name);
> >  		else if (!data &&
> > -			 (!(stream = odb_read_stream_open(r->objects, &oid, NULL)) ||
> > +			 (packfile_read_object_stream(&stream, p, entries[i].offset) < 0 ||
> 
> And now this change is delightfully simple.
> 
> > +test_expect_success 'fsck handles multiple packfiles with big blobs' '
> > +	test_when_finished "rm -rf repo" &&
> > +	git init repo &&
> > +	(
> > +		cd repo &&
> > +		blob_one=$(test-tool genrandom one 200k | git hash-object -t blob -w --stdin) &&
> > +		blob_two=$(test-tool genrandom two 200k | git hash-object -t blob -w --stdin) &&
> > +		printf "%s\n" "$blob_one" | git pack-objects .git/objects/pack/pack &&
> > +		printf "%s\n" "$blob_two" | git pack-objects .git/objects/pack/pack &&
> > +		remove_object "$blob_one" &&
> > +		remove_object "$blob_two" &&
> > +		git -c core.bigFileThreshold=100k fsck
> > +	)
> > +'
> 
> I like seeing this much-more-specific test case. It does sort of become
> a noop if we fix the iteration problem, though.
> 
> 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.

Thanks!

Patrick

  reply	other threads:[~2026-02-23 11:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-23  9:50 [PATCH 0/4] pack-check: fix verification of large objects Patrick Steinhardt
2026-02-23  9:50 ` [PATCH 1/4] t/helper: improve "genrandom" test helper Patrick Steinhardt
2026-02-23 11:13   ` Jeff King
2026-02-23 12:20     ` Patrick Steinhardt
2026-02-23 14:01   ` Eric Sunshine
2026-02-23  9:50 ` [PATCH 2/4] object-file: adapt `stream_object_signature()` to take a stream Patrick Steinhardt
2026-02-23 10:49   ` Jeff King
2026-02-23 12:21     ` Patrick Steinhardt
2026-02-23 12:59       ` Jeff King
2026-02-23  9:50 ` [PATCH 3/4] packfile: expose function to read object stream for an offset Patrick Steinhardt
2026-02-23 11:07   ` Jeff King
2026-02-23 12:21     ` Patrick Steinhardt
2026-02-23 13:12       ` Jeff King
2026-02-23 15:59         ` Patrick Steinhardt
2026-02-23  9:50 ` [PATCH 4/4] pack-check: fix verification of large objects Patrick Steinhardt
2026-02-23 11:11   ` Jeff King
2026-02-23 11:30     ` Patrick Steinhardt [this message]
2026-02-23 12:58       ` Jeff King
2026-02-23 15:48         ` Patrick Steinhardt
2026-02-23 20:35   ` Junio C Hamano
2026-02-24  6:26     ` Patrick Steinhardt
2026-02-23 16:00 ` [PATCH v2 0/4] " Patrick Steinhardt
2026-02-23 16:00   ` [PATCH v2 1/4] t/helper: improve "genrandom" test helper Patrick Steinhardt
2026-02-23 16:00   ` [PATCH v2 2/4] object-file: adapt `stream_object_signature()` to take a stream Patrick Steinhardt
2026-02-23 16:00   ` [PATCH v2 3/4] packfile: expose function to read object stream for an offset Patrick Steinhardt
2026-02-23 16:00   ` [PATCH v2 4/4] pack-check: fix verification of large objects Patrick Steinhardt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aZw6W_BHoYiC9RYl@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.