From: Bagas Sanjaya Date: Thu, 24 Jun 2021 04:22:47 GMT Subject: Re: [PATCH 4/4] midx: report checksum mismatches during 'verify' Message-ID: In-Reply-To: <94e9de44e3b52513c5ab48aecd74f809dc34cbe3.1624473543.git.me@ttaylorr.com> On 24/06/21 01.39, Taylor Blau wrote: > 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")); > + ... > +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