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

[BUG REPORT] git fetch --prefetch with incorrect options hangs with 2.47.0

From
EMEric Mills <ermills@epic.com>
Date
Nov 11, 2024, 22:15 UTC
Message-ID
<SA1PR17MB6501281EF202EA694CF9DC03CA582@SA1PR17MB6501.namprd17.prod.outlook.com>

Eric Mills (he/him) | Epic | Hyperspace ermills@epic.com | (608) 271-9000

Thank you for filling out a Git bug report! Please answer the following questions to help us understand your issue.

What did you do before the bug happened? (Steps to reproduce your issue) I ran `git fetch --prefetch origin main` with git 2.47 on both my Windows machine (2.47.windows.2) and my Mac (2.47.0) and it hangs.

When I downgrade, same command succeeds on 2.46.2.Windows.1 / 2.46.2 (macOS).

What did you expect to happen? (Expected behavior) I expect the fetch to complete without hanging as it does in 2.46.2.

Note that while investigating this, I learned that `git fetch --prefetch` may not be meant to be run with specific refs. The idea was to prefetch `main`, but it seems that in 2.46.2 this prefetches all refs from that remote even when a specific ref is given. If prefetching specific refs is explicitly not allowed, I would expect a more targeted error message instead of hanging. If it is meant to work, I would expect that only that ref is prefetched.

What happened instead? (Actual behavior) It hangs to the point that I have to end the process in Task Manager.

What's different between what you expected and what actually happened? I don't expect the command to hang.

Anything else you want to add: To quickly recap, the hang occurs on both macOS and Windows. It doesn't happen in 2.46.2, but does happen in 2.47.0.

Even though I might be using the command incorrectly, I thought it was worth reporting because it seems to be a regression.

I found the issue on Windows, but since I could reproduce it on macOS (or something similar on macOS), I'm filing the issue upstream.

On Windows, I don't get an error. It hangs indefinitely. On macOS, after a few seconds I got the following:

git(84051,0x20171cf40) malloc: *** error for object 0x600001978390: pointer being freed was not allocated

git(84051,0x20171cf40) malloc: *** set a breakpoint in malloc_error_break to debug

[1]    84051 abort      git fetch --prefetch origin main

Please review the rest of the bug report below. You can delete any lines you don't wish to share.

[System Info]
git version:
git version 2.47.0.windows.2
cpu: x86_64
built from commit: 1f8a83cba6e88fad4b881885e64cfb89458e3653
sizeof-long: 4
sizeof-size_t: 8
shell-path: D:/git-sdk-64-build-installers/usr/bin/sh
feature: fsmonitor--daemon
libcurl: 8.10.1
OpenSSL: OpenSSL 3.2.3 3 Sep 2024
zlib: 1.3.1
uname: Windows 10.0 22631
compiler info: gnuc: 14.2
libc info: no libc information available
$SHELL (typically, interactive shell): C:\Program Files\Git\usr\bin\bash.exe
[Enabled Hooks]
Next: Jeff King
Message 1 of 7 in “[BUG REPORT] git fetch --prefetch with incorrect options hangs with 2.47.0”
  1. Eric MillsNov 11, 2024
  2. Jeff KingNov 12, 2024
  3. 0/3 double-free with git fetch --prefetchJeff King, Nov 12, 2024
  4. 1/3 fetch: adjust refspec->raw_nr when filtering prefetch refspecsJeff King, Nov 12, 2024
  5. 2/3 refspec: drop separate raw_nr countJeff King, Nov 12, 2024
  6. 3/3 refspec: store raw refspecs inside refspec_itemJeff King, Nov 12, 2024
  7. Junio C HamanoNov 12, 2024

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.