Re: [PATCH v2 1/4] pack-bitmap.c: check preferred pack validity when opening MIDX bitmap
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- May 24, 2022, 19:36 UTC
- Message-ID
- <220524.864k1ewwh4.gmgdl@evledraar.gmail.com>
- In-Reply-To
- <618e8a6166473d238e62ce6243d9a0b2b72ee2f0.1653418457.git.me@ttaylorr.com>
On Tue, May 24 2022, Taylor Blau wrote:
Just nits on the error reporting:
Show 9 quoted lines
> @@ -353,6 +355,20 @@ static int open_midx_bitmap_1(struct bitmap_index *bitmap_git,
> warning(_("multi-pack bitmap is missing required reverse index"));
> goto cleanup;
> }
> +
> + for (i = 0; i < bitmap_git->midx->num_packs; i++) {
> + if (prepare_midx_pack(the_repository, bitmap_git->midx, i))
> + die(_("could not open pack %s"),
> + bitmap_git->midx->pack_names[i]);Some existing API users of this & their error handling suggest that this message is wrong. I.e. it's not that we couldn't open it, but that we could open it and there's something wrong with it. Or perhaps their messages are misleading?
Show 6 quoted lines
> + }
> +
> + preferred = bitmap_git->midx->packs[midx_preferred_pack(bitmap_git)];
> + if (!is_pack_valid(preferred)) {
> + warning(_("preferred pack (%s) is invalid"),
> + preferred->pack_name);Likewise this? E.g. perhaps the permissions are just wrong or whatever, per open_packed_git_1().