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

Re: Segmentation fault within git read-tree

From
Jeff King <peff@peff.net>
Date
Jan 15, 2023, 18:35 UTC
Message-ID
<Y8RHfjFFLRdW3WRh@coredump.intra.peff.net>
In-Reply-To
<CAP8UFD0pKZT57jpUOg7gckcr4stoq24YDB2Fu0-AwbGPrEweqg@mail.gmail.com>
On Sun, Jan 15, 2023 at 12:53:25PM +0100, Christian Couder wrote:
Show 13 quoted lines
> From a very quick look, it seems that in setup_traverse_info() in
> tree-walk.c we do:
> 
>     static struct traverse_info dummy;
> ...
>     if (pathlen)
>         info->prev = &dummy;
> 
> but then later in debug_path() in unpack-trees.c we check
> *info->prev->name which segfaults.
> 
> I am not very familiar with this code and don't have much time right
> now, so I think I will leave it to others to investigate this further.

I'm not sure if Frédéric is seeing another segfault in practice (when not using --debug-unpack), but yeah, it is very easy to trigger this segfault. It does not even have to do with sparse checkouts, etc. Here's an even more minimal example:

  git init repo
  cd repo
  touch file
  git add file
  git commit -m added
  git read-tree --debug-unpack --prefix=subtree HEAD

I was going to bisect, but it looks like it was broken all the way back to Junio's ba655da537 (read-tree --debug-unpack, 2009-09-14).

-Peff
Previous: Christian CouderNext: Junio C Hamano
Message 3 of 4 in “Segmentation fault within git read-tree”
  1. Frédéric FortJan 14, 2023
  2. Christian CouderJan 15, 2023
  3. Jeff KingJan 15, 2023
  4. Junio C HamanoJan 15, 2023

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.