Subject: Re: [PATCH 0/6] midx: permit changing the preferred pack when reusing the MIDX

From: Derrick Stolee <[email-masked]>
Date: Mon, 22 Aug 2022 13:04:29 -0400

On 8/19/2022 5:30 PM, Taylor Blau wrote:
> This series resolves a bug that was reported[1] by Johannes, and
> investigated by him, Abhradeep, and Stolee in that same sub-thread.
> 
> The crux of the issue is that a MIDX bitmap can enter a corrupt state
> when changing the preferred pack from its value in an existing MIDX in
> certain circumstances as described in the first and final patches.
> 
> This series is structured as follows:
> 
>   - The first patch of this series adds a test which demonstrates the
>     problem. (This is an improvement from the debugging in [1], where we
>     only noticed the problem racily in an existing test, and only in
>     SHA-256 mode).
> 
>   - The next small handful of patches refactor midx.c's
>     `get_sorted_entries()` function to make fixing this bug more
>     straightforward.
> 
>   - The final patch resolves the bug and updates the test to no longer
>     expect failure.

Thanks for putting this together. Definitely not an easy bug to find
and fix.

I mostly have nitpicks, but the overall structure is sound.

Thanks,
-Stolee