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

Re: problem with http clone/pull

From
Junio C Hamano <junkio@cox.net>
Date
Sep 12, 2006, 23:43 UTC
Message-ID
<7vodtkejm9.fsf@assigned-by-dhcp.cox.net>
In-Reply-To
<17671.16741.995661.664789@cargo.ozlabs.ibm.com>
Paul Mackerras <paulus@samba.org> writes:
Show 5 quoted lines
> Getting alternates list for http://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git/
> Also look at http://git.kernel.or
> error: Couldn't resolve host 'git.kernel.orobjects' (curl_result = 6, http_code = 0, sha1 = c336923b668fdcf0312efbec3b44895d713f4d81)
> Getting pack list for http://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git/
> Getting pack list for http://git.kernel.or

I've seen this "last character of hostname dropped" symptom mentioned on the #git channel long time ago, but I do not remember if somebody figured out what the problem was. I know that nobody did a patch to specifically fix it.

Among the changes since v1.3.0 that touches http-fetch.c the only thing I can see that touches anything related to alternates handling is this one, but I do not see anything obviously wrong with it X-<.

commit bfbd0bb6ecbbbf75a5caaff6afaf5a6af8fa518e
Date:   Sun Jun 11 14:03:28 2006 +0200
    Implement safe_strncpy() as strlcpy() and use it more.
    
diff --git a/http-fetch.c b/http-fetch.c
index d3602b7..da1a7f5 100644
--- a/http-fetch.c
+++ b/http-fetch.c
@@ -584,10 +584,8 @@ static void process_alternates_response(
 			// skip 'objects' at end
 			if (okay) {
 				target = xmalloc(serverlen + posn - i - 6);
-				strncpy(target, base, serverlen);
-				strncpy(target + serverlen, data + i,
-					posn - i - 7);
-				target[serverlen + posn - i - 7] = '\0';
+				safe_strncpy(target, base, serverlen);
+				safe_strncpy(target + serverlen, data + i, posn - i - 6);
 				if (get_verbosely)
 					fprintf(stderr,
 						"Also look at %s\n", target);
Previous: Paul MackerrasNext: Junio C Hamano
Message 2 of 6 in “problem with http clone/pull”
  1. Paul MackerrasSep 12, 2006
  2. Junio C HamanoSep 12, 2006
  3. Junio C HamanoSep 13, 2006
  4. Junio C HamanoSep 13, 2006
  5. Paul MackerrasSep 13, 2006
  6. Junio C HamanoSep 13, 2006

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.