Re: [PATCH 4/4] midx: report checksum mismatches during 'verify'
- From
Bagas Sanjaya <bagasdotme@gmail.com>
- Date
- Jun 24, 2021, 04:22 UTC
- Message-ID
- <dab8eb4a-3e8e-ea3f-20ba-5164655841f2@gmail.com>
- In-Reply-To
- <94e9de44e3b52513c5ab48aecd74f809dc34cbe3.1624473543.git.me@ttaylorr.com>
On 24/06/21 01.39, Taylor Blau wrote:
Show 10 quoted lines
> But it does not check that the file's trailing checksum matches the data > that it records. So, if an on-disk corruption happened to occur in the > final few bytes (and all other data was recorded correctly), we would: > > - get a clean result from 'git multi-pack-index verify', but > - be unable to reuse the existing MIDX when writing a new one (since > we now check for checksum mismatches before reusing a MIDX) > > Teach the 'verify' sub-command to recognize corruption in the checksum > by calling midx_checksum_valid().
...
> + if (!midx_checksum_valid(m))
> + midx_report(_("incorrect checksum"));
> +...
Show 5 quoted lines
> +test_expect_success 'verify incorrect checksum' ' > + pos=$(($(wc -c <$objdir/pack/multi-pack-index) - 1)) && > + corrupt_midx_and_verify $pos "\377" $objdir "incorrect checksum" > +' > +
We're in the context of checksum mismatches because of on-disk corruption, so why didn't the message say "incorrect checksum, possibly corrupt"?
-- An old man doll... just what I always wanted! - Clara