git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: What's cooking in git.git (Oct 2021, #02; Wed, 6)

From
Taylor Blau <me@ttaylorr.com>
Date
Oct 7, 2021, 04:15 UTC
Message-ID
<YV50cEN6hdvNOrpE@nand.local>
In-Reply-To
<87wnmph73b.fsf@evledraar.gmail.com>
On Thu, Oct 07, 2021 at 04:57:10AM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 5 quoted lines
> @@ -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

Previous: Ævar Arnfjörð BjarmasonNext: Taylor Blau
Message 22 of 24 in “What's cooking in git.git (Oct 2021, #02; Wed, 6)”
  1. Junio C HamanoOct 7, 2021
  2. ab/make-sparse-for-realÆvar Arnfjörð Bjarmason, Oct 7, 2021
  3. Jeff KingOct 7, 2021
  4. Jeff KingOct 7, 2021
  5. Taylor BlauOct 7, 2021
  6. Jeff KingOct 8, 2021
  7. Johannes SchindelinOct 8, 2021
  8. Jeff KingOct 8, 2021
  9. Johannes SchindelinOct 20, 2021
  10. Taylor BlauOct 20, 2021
  11. Junio C HamanoOct 20, 2021
  12. Jeff KingOct 20, 2021
  13. Coverity, was Re: What's cooking in git.git (Oct 2021, #02; Wed, 6)Johannes Schindelin, Aug 16, 2022
  14. Jeff KingAug 17, 2022
  15. Johannes SchindelinAug 19, 2022
  16. Ævar Arnfjörð BjarmasonOct 7, 2021
  17. Jeff KingOct 8, 2021
  18. Junio C HamanoOct 8, 2021
  19. Jeff KingOct 8, 2021
  20. Junio C HamanoOct 8, 2021
  21. Ævar Arnfjörð BjarmasonOct 7, 2021
  22. Taylor BlauOct 7, 2021
  23. Taylor BlauOct 7, 2021
  24. Junio C HamanoOct 7, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.