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

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

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2008, 16:15 UTC
Message-ID
<7vljwb5o4p.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<237967ef0810260746w10e930c1sf36a2674f49afbe1@mail.gmail.com>
"Mikael Magnusson" <mikachu@gmail.com> writes:
Show 8 quoted lines
> % 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.

Can you try this patch?
 sha1_file.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
diff --git i/sha1_file.c w/sha1_file.c
index ab2b520..98e7d7a 100644
--- i/sha1_file.c
+++ w/sha1_file.c
@@ -402,9 +402,11 @@ void foreach_alt_odb(alt_odb_fn fn, void *cb)
 	struct alternate_object_database *ent;
 
 	prepare_alt_odb();
-	for (ent = alt_odb_list; ent; ent = ent->next)
+	for (ent = alt_odb_list; ent; ent = ent->next) {
+		*ent->name = '\0';
 		if (fn(ent, cb))
 			return;
+	}
 }
 
 void prepare_alt_odb(void)
Previous: Mikael MagnussonNext: Mikael Magnusson
Message 2 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.