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

Re: Weird problem with long $PATH and alternates (bisected)

From
René Scharfe <rene.scharfe@lsrfire.ath.cx>
Date
Oct 26, 2008, 17:53 UTC
Message-ID
<4904AE8D.9090706@lsrfire.ath.cx>
In-Reply-To
<7vljwb5o4p.fsf@gitster.siamese.dyndns.org>
Junio C Hamano schrieb:
Show 14 quoted lines
> "Mikael Magnusson" <mikachu@gmail.com> writes:
> 
>> % mkdir 1; cd 1
>> % echo > a; git add a; git commit -m a
>> % cd ..
>> % git clone -s 1 2
>> % git push . master:master
>> fatal: Could not switch to
>> '/tmp/a/1/.git/objects/n:/usr/games/bin:/usr/local/ipod-chain'
>> fatal: The remote end hung up unexpectedly
> 
> I think I see a bug in foreach_alt_odb() to add_refs_from_alternate()
> callchain, but I cannot explain why the contents of $PATH leaks to the
> error message.

With the following patch, I can no longer reproduce the problem. Does it work fo you, too?

Thanks, René

diff --git a/sha1_file.c b/sha1_file.c
index ab2b520..8044e9c 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -269,7 +269,7 @@ static int link_alt_odb_entry(const char * entry, int len, const char * relative
 		entlen += base_len;
 		pfxlen += base_len;
 	}
-	ent = xmalloc(sizeof(*ent) + entlen);
+	ent = xcalloc(1, sizeof(*ent) + entlen);
 
 	if (!is_absolute_path(entry) && relative_base) {
 		memcpy(ent->base, relative_base, base_len - 1);
Previous: Mikael MagnussonNext: Junio C Hamano
Message 4 of 7 in “Weird problem with long $PATH and alternates (bisected)”
  1. Mikael MagnussonOct 26, 2008
  2. Junio C HamanoOct 26, 2008
  3. Mikael MagnussonOct 26, 2008
  4. René ScharfeOct 26, 2008
  5. Junio C HamanoOct 26, 2008
  6. Mikael MagnussonOct 26, 2008
  7. Junio C HamanoOct 27, 2008

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.