From: Derrick Stolee <derrickstolee@github.com>
To: Patrick Steinhardt <ps@pks.im>, git@vger.kernel.org
Cc: Taylor Blau <me@ttaylorr.com>, peff@peff.net, dstolee@microsoft.com
Subject: Re: [PATCH v3 01/10] midx: fix segfault with no packs and invalid preferred pack
Date: Thu, 13 Apr 2023 09:49:34 -0400 [thread overview]
Message-ID: <1d2e1796-c305-0876-533c-2fe0fd39d722@github.com> (raw)
In-Reply-To: <dd8145beade440e5444130d3a3189b2c5d15a911.1681384405.git.ps@pks.im>
On 4/13/2023 7:16 AM, Patrick Steinhardt wrote:
> Fix this bug by resetting the preferred packfile index to `-1` before
> searching for the preferred pack. This fixes the segfault as we already
> check for whether the index is `> - 1`. If it is not, we simply don't
> pick a preferred packfile at all.
> if (preferred_pack_name) {
> - int found = 0;
> + ctx.preferred_pack_idx = -1;
> +
This patch looks good, but I did need to think about it for a bit,
so here are my thoughts (feel free to ignore):
I briefly considered recommending that we set this as the default in
an initializer macro, something like
#define WRITE_MIDX_CONTEXT_INIT { .preferred_pack_idx = -1 }
but this struct is internal to the file and only constructed once
(at the start of write_midx_internal).
Further, outside the context of this patch we have this code:
} else if (ctx.nr &&
(flags & (MIDX_WRITE_REV_INDEX | MIDX_WRITE_BITMAP))) {
struct packed_git *oldest = ctx.info[ctx.preferred_pack_idx].p;
ctx.preferred_pack_idx = 0;
I don't see a way that ctx.preferred_pack_idx can be anything but zero
here, but it's also not going to give a segfault because of the 'ctx.nr'
condition.
Thanks,
-Stolee
next prev parent reply other threads:[~2023-04-13 13:49 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-04 11:08 [PATCH] repack: fix geometric repacking with gitalternates Patrick Steinhardt
2023-04-04 18:55 ` Taylor Blau
2023-04-04 19:00 ` Taylor Blau
2023-04-05 7:08 ` Patrick Steinhardt
2023-04-10 15:06 ` Derrick Stolee
2023-04-10 23:49 ` Taylor Blau
2023-04-11 17:13 ` Patrick Steinhardt
2023-04-11 21:13 ` Taylor Blau
2023-04-12 9:37 ` Patrick Steinhardt
2023-04-11 17:06 ` Patrick Steinhardt
2023-04-11 17:26 ` Patrick Steinhardt
2023-04-11 21:14 ` Taylor Blau
2023-04-10 23:29 ` Taylor Blau
2023-04-12 10:22 ` [PATCH v2 0/8] " Patrick Steinhardt
2023-04-12 10:22 ` [PATCH v2 1/8] midx: fix segfault with no packs and invalid preferred pack Patrick Steinhardt
2023-04-12 17:56 ` Taylor Blau
2023-04-13 9:28 ` Patrick Steinhardt
2023-04-12 10:22 ` [PATCH v2 2/8] repack: fix trying to use preferred pack in alternates Patrick Steinhardt
2023-04-12 18:37 ` Taylor Blau
2023-04-13 9:31 ` Patrick Steinhardt
2023-04-12 10:22 ` [PATCH v2 3/8] repack: fix generating multi-pack-index with only non-local packs Patrick Steinhardt
2023-04-12 20:39 ` Taylor Blau
2023-04-12 10:22 ` [PATCH v2 4/8] pack-objects: fix error when packing same pack twice Patrick Steinhardt
2023-04-12 21:33 ` Taylor Blau
2023-04-12 10:22 ` [PATCH v2 5/8] pack-objects: fix error when same packfile is included and excluded Patrick Steinhardt
2023-04-12 21:52 ` Taylor Blau
2023-04-12 10:22 ` [PATCH v2 6/8] pack-objects: extend test coverage of `--stdin-packs` with alternates Patrick Steinhardt
2023-04-12 10:22 ` [PATCH v2 7/8] repack: honor `-l` when calculating pack geometry Patrick Steinhardt
2023-04-12 23:56 ` Junio C Hamano
2023-04-13 5:11 ` Junio C Hamano
2023-04-13 6:41 ` Patrick Steinhardt
2023-04-12 10:23 ` [PATCH v2 8/8] repack: disable writing bitmaps when doing a local geometric repack Patrick Steinhardt
2023-04-12 22:01 ` Taylor Blau
2023-04-13 9:54 ` Patrick Steinhardt
2023-04-13 10:14 ` Patrick Steinhardt
2023-04-12 22:02 ` [PATCH v2 0/8] repack: fix geometric repacking with gitalternates Taylor Blau
2023-04-13 11:16 ` [PATCH v3 00/10] " Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 01/10] midx: fix segfault with no packs and invalid preferred pack Patrick Steinhardt
2023-04-13 13:49 ` Derrick Stolee [this message]
2023-04-13 11:16 ` [PATCH v3 02/10] repack: fix trying to use preferred pack in alternates Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 03/10] repack: fix generating multi-pack-index with only non-local packs Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 04/10] pack-objects: split out `--stdin-packs` tests into separate file Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 05/10] pack-objects: fix error when packing same pack twice Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 06/10] pack-objects: fix error when same packfile is included and excluded Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 07/10] pack-objects: extend test coverage of `--stdin-packs` with alternates Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 08/10] t/helper: allow chmtime to print verbosely without modifying mtime Patrick Steinhardt
2023-04-13 11:16 ` [PATCH v3 09/10] repack: honor `-l` when calculating pack geometry Patrick Steinhardt
2023-04-13 13:59 ` Derrick Stolee
2023-04-13 14:13 ` Patrick Steinhardt
2023-04-13 15:40 ` Junio C Hamano
2023-04-13 11:16 ` [PATCH v3 10/10] repack: disable writing bitmaps when doing a local repack Patrick Steinhardt
2023-04-13 14:54 ` [PATCH v3 00/10] repack: fix geometric repacking with gitalternates Derrick Stolee
2023-04-14 2:03 ` Junio C Hamano
2023-04-14 5:42 ` Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 " Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 01/10] midx: fix segfault with no packs and invalid preferred pack Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 02/10] repack: fix trying to use preferred pack in alternates Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 03/10] repack: fix generating multi-pack-index with only non-local packs Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 04/10] pack-objects: split out `--stdin-packs` tests into separate file Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 05/10] pack-objects: fix error when packing same pack twice Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 06/10] pack-objects: fix error when same packfile is included and excluded Patrick Steinhardt
2023-04-14 6:01 ` [PATCH v4 07/10] pack-objects: extend test coverage of `--stdin-packs` with alternates Patrick Steinhardt
2023-04-14 6:02 ` [PATCH v4 08/10] t/helper: allow chmtime to print verbosely without modifying mtime Patrick Steinhardt
2023-04-14 6:02 ` [PATCH v4 09/10] repack: honor `-l` when calculating pack geometry Patrick Steinhardt
2023-04-14 6:02 ` [PATCH v4 10/10] repack: disable writing bitmaps when doing a local repack Patrick Steinhardt
2023-04-14 13:23 ` [PATCH v4 00/10] repack: fix geometric repacking with gitalternates Derrick Stolee
2023-04-14 17:29 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d2e1796-c305-0876-533c-2fe0fd39d722@github.com \
--to=derrickstolee@github.com \
--cc=dstolee@microsoft.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.