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

Re: git write-tree segfault with core.untrackedCache true and nonexistent index

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 22, 2022, 19:41 UTC
Message-ID
<xmqq35etc4vm.fsf@gitster.g>
In-Reply-To
<20220722192559.718264-1-martin.agren@gmail.com>
Martin Ågren <martin.agren@gmail.com> writes:
Show 9 quoted lines
> I can't help but think that e6a653554b was just unlucky enough to
> dereference `istate->repo` and that the real issue is that we're missing
>
> 	if (!istate->repo)
> 		istate->repo = the_repository;
>
> in some strategic place a fair bit earlier. It seems to me like the diff
> below is just papering over the real bug. It's not obvious to me where
> that check would want to go, though. Tao, do you have an idea?
I am not Tao, but thanks for starting to analyze the real issue.

It seems that there are two public entry points to dir.c API that end up calling new_untracked_cache_flags().

One is read_directory(), which is the only caller of validate_untracked_cache() that calls new_untracked_cache_flags(). The callers of read_directory() are supposed to give istate, and it is quite unlikely they are throwing an istate with NULL in istate->repo, simply because read_directory() already makes abundant use of istate->repo.

The other one is add_untracked_cache().

Perhaps backtrace to see where the istate came from would quickly reveal where the real issue lies?

Thanks.
Previous: Martin ÅgrenNext: Martin Ågren
Message 3 of 6 in “git write-tree segfault with core.untrackedCache true and nonexistent index”
  1. Joey HessJul 22, 2022
  2. Martin ÅgrenJul 22, 2022
  3. Junio C HamanoJul 22, 2022
  4. read-cache: make `do_read_index()` always set up `istate->repo`Martin Ågren, Jul 22, 2022
  5. Junio C HamanoJul 22, 2022
  6. Martin ÅgrenJul 22, 2022

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.