git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: Jeff King <peff@peff.net>, Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: What's cooking in git.git (Oct 2021, #02; Wed, 6)
Date: Thu, 7 Oct 2021 00:15:44 -0400	[thread overview]
Message-ID: <YV50cEN6hdvNOrpE@nand.local> (raw)
In-Reply-To: <87wnmph73b.fsf@evledraar.gmail.com>

On Thu, Oct 07, 2021 at 04:57:10AM +0200, Ævar Arnfjörð Bjarmason wrote:
> @@ -1927,11 +1929,9 @@ int midx_repack(struct repository *r, const char *object_dir, size_t batch_size,
>  	}
>
>  	result = write_midx_internal(object_dir, NULL, NULL, NULL, NULL, flags);
> -	m = NULL;

This was the only hunk that gave me a little bit of pause. But it is the
right thing to be doing.

When this code was originally written, write_midx_internal took a
pointer to a struct multi_pack_index, and sometimes called close_midx()
on that pointer. Calling close_midx() on the same pointer is UB, since
close_midx() frees the provided pointer.

In other words, when this code was originally written, the 'm' variable
in midx_repack() could become stale.

But since f57a739691 (midx: avoid opening multiple MIDXs when writing,
2021-09-01), we don't pass a pointer into write_midx_internal(), only
the path to an object directory. So we can always call close_midx()
here.

Thanks,
Taylor

  reply	other threads:[~2021-10-07  4:16 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07  0:24 What's cooking in git.git (Oct 2021, #02; Wed, 6) Junio C Hamano
2021-10-07  2:01 ` ab/make-sparse-for-real Ævar Arnfjörð Bjarmason
2021-10-07  2:24 ` What's cooking in git.git (Oct 2021, #02; Wed, 6) Jeff King
2021-10-07  2:38   ` Jeff King
2021-10-07  4:07     ` Taylor Blau
2021-10-08  3:55       ` Jeff King
2021-10-08  7:51         ` Johannes Schindelin
2021-10-08 21:32           ` Jeff King
2021-10-20 12:27             ` Johannes Schindelin
2021-10-20 14:30               ` Taylor Blau
2021-10-20 14:47               ` Junio C Hamano
2021-10-20 16:13               ` Jeff King
2022-08-16  9:05                 ` Coverity, was " Johannes Schindelin
2022-08-17  0:57                   ` Jeff King
2022-08-19 11:22                     ` Johannes Schindelin
2021-10-07  7:42     ` Ævar Arnfjörð Bjarmason
2021-10-08  4:10       ` Jeff King
2021-10-08 20:03         ` Junio C Hamano
2021-10-08 20:19           ` Jeff King
2021-10-08 21:57             ` Junio C Hamano
2021-10-07  2:57   ` Ævar Arnfjörð Bjarmason
2021-10-07  4:15     ` Taylor Blau [this message]
2021-10-07  3:55   ` Taylor Blau
2021-10-07 18:02   ` 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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YV50cEN6hdvNOrpE@nand.local \
    --to=me@ttaylorr.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=peff@peff.net \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).