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

Re: [PATCH] diff: avoid segfault with freed entries

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 30, 2025, 04:38 UTC
Message-ID
<xmqqtsx8h9dl.fsf@gitster.g>
In-Reply-To
<pull.2027.git.1767044697712.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
> The more elaborate explanation is that within diffcore_std(), we may
> skip the initial prefetch due to the output format (--name-only in the
> test) and go straight to diffcore_skip_stat_unmatch().

That's very interesting. We have code to fetch on-demand when it turns out that the initial prefetch shouldn't have been skipped and we need contents, so in that sense, the condition to skip the initial prefetch does not have to be precise, but we may want to see if we can have a single helper function that exactly tells us if we need to look at the contents or not. I think we had a few changes that made the definition of "diff status is based on contents" in the past few releases, not for the purpose of this prefetch skipping but to set the exit status.

Previous: Derrick Stolee via GitGitGadgetNext: Kristoffer Haugsbakk
Message 2 of 3 in “diff: avoid segfault with freed entries”
  1. diff: avoid segfault with freed entriesDerrick Stolee via GitGitGadget, Dec 29, 2025
  2. Junio C HamanoDec 30, 2025
  3. Kristoffer HaugsbakkDec 30, 2025

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.