Re: [PATCH 6/9] commit-graph: use fanout value for graph size
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Nov 9, 2023, 21:20 UTC
- Message-ID
- <ZU1NNcP/ARxK6D89@nand.local>
- In-Reply-To
- <20231109072435.GF2698043@coredump.intra.peff.net>
On Thu, Nov 09, 2023 at 02:24:35AM -0500, Jeff King wrote:
Show 9 quoted lines
> @@ -323,7 +320,8 @@ static int graph_read_oid_lookup(const unsigned char *chunk_start,
> {
> struct commit_graph *g = data;
> g->chunk_oid_lookup = chunk_start;
> - g->num_commits = chunk_size / g->hash_len;
> + if (chunk_size / g->hash_len != g->num_commits)
> + return error(_("commit-graph OID lookup chunk is the wrong size"));
> return 0;
> }My understanding is that you need this error message to come from graph_read_oid_lookup() in order to pass the "detect incorrect fanout final value" test, but I wish that we didn't have to, since having the more-or-less duplicate error messages in the latter "reader notices fanout/lookup table mismatch" is somewhat unfortunate.
Show 26 quoted lines
> diff --git a/t/t5318-commit-graph.sh b/t/t5318-commit-graph.sh > index affb959d64..8bd7fcefb5 100755 > --- a/t/t5318-commit-graph.sh > +++ b/t/t5318-commit-graph.sh > @@ -560,7 +560,7 @@ test_expect_success 'detect incorrect fanout' ' > > test_expect_success 'detect incorrect fanout final value' ' > corrupt_graph_and_verify $GRAPH_BYTE_FANOUT2 "\01" \ > - "oid table and fanout disagree on size" > + "OID lookup chunk is the wrong size" > ' > > test_expect_success 'detect incorrect OID order' ' > @@ -850,7 +850,8 @@ test_expect_success 'reader notices too-small oid fanout chunk' ' > test_expect_success 'reader notices fanout/lookup table mismatch' ' > check_corrupt_chunk OIDF 1020 "FFFFFFFF" && > cat >expect.err <<-\EOF && > - error: commit-graph oid table and fanout disagree on size > + error: commit-graph OID lookup chunk is the wrong size > + error: commit-graph required OID lookup chunk missing or corrupted > EOF > test_cmp expect.err err > ' > -- > 2.43.0.rc1.572.g273fc7bed6 >
Thanks, Taylor