# Re: \[PATCH\] t5319: corrupt more bytes of the midx checksum

- From: Derrick Stolee \<hidden\>
- Date: 2021-11-16 22:13:05 
- List: git
- Page: https://ratatoskr.run/git/2021/11/7911654
- Thread: https://ratatoskr.run/git/2021/06/7893273/t.md

```text
On 11/16/2021 4:38 PM, Jeff King wrote:
> So very occasionally we can end up with a real 0xff byte, and the test
> fails. The most robust fix would be to read out the final byte and then
> change it to something else (e.g., adding 1 mod 256). But that's awkward
> to do in shell. Let's just blindly corrupt 10 bytes instead of 1, which
> reduces our chances of an accidental noop to 1 in 2^80.
> 
> Reported-by: SZEDER Gábor <redacted>
> Signed-off-by: Jeff King <redacted>
> ---
>  t/t5319-multi-pack-index.sh | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh
> index 3f69e43178..a612e44547 100755
> --- a/t/t5319-multi-pack-index.sh
> +++ b/t/t5319-multi-pack-index.sh
> @@ -482,8 +482,10 @@ test_expect_success 'corrupt MIDX is not reused' '
>  '
>  
>  test_expect_success 'verify incorrect checksum' '
> -	pos=$(($(wc -c <$objdir/pack/multi-pack-index) - 1)) &&
> -	corrupt_midx_and_verify $pos "\377" $objdir "incorrect checksum"
> +	pos=$(($(wc -c <$objdir/pack/multi-pack-index) - 10)) &&
> +	corrupt_midx_and_verify $pos \
> +		"\377\377\377\377\377\377\377\377\377\377" \
> +		$objdir "incorrect checksum"
>  '

Thanks for taking the time to make this a patch. This approach looks
good to me.

Thanks,
-Stolee
```
