* problem with http clone/pull @ 2006-09-12 23:23 Paul Mackerras 2006-09-12 23:43 ` Junio C Hamano 0 siblings, 1 reply; 6+ messages in thread From: Paul Mackerras @ 2006-09-12 23:23 UTC (permalink / raw) To: Junio C Hamano; +Cc: git Junio, Users are having problems doing clones or pulls of my powerpc.git tree on kernel.org with version 1.4.2 of git. Apparently earlier versions work OK. When I do: git clone http://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git it produces the following output: 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 error: Couldn't resolve host 'git.kernel.or' error: Unable to find c336923b668fdcf0312efbec3b44895d713f4d81 under http://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc.git/ Cannot obtain needed none c336923b668fdcf0312efbec3b44895d713f4d81 while processing commit 0000000000000000000000000000000000000000. Now, this repository has a objects/info/alternates file that contains the single line: /pub/scm/linux/kernel/git/torvalds/linux-2.6.git/objects I also have a hooks/post-update with execute permission, that does exec git-update-server-info. Is there anything obviously wrong in how I have set this up, or is it a new bug in git 1.4.2? Thanks, Paul. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: problem with http clone/pull 2006-09-12 23:23 problem with http clone/pull Paul Mackerras @ 2006-09-12 23:43 ` Junio C Hamano 2006-09-13 0:06 ` Junio C Hamano 0 siblings, 1 reply; 6+ messages in thread From: Junio C Hamano @ 2006-09-12 23:43 UTC (permalink / raw) To: Paul Mackerras; +Cc: git Paul Mackerras <paulus@samba.org> writes: > 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); ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: problem with http clone/pull 2006-09-12 23:43 ` Junio C Hamano @ 2006-09-13 0:06 ` Junio C Hamano 2006-09-13 0:39 ` Junio C Hamano 2006-09-13 1:08 ` Paul Mackerras 0 siblings, 2 replies; 6+ messages in thread From: Junio C Hamano @ 2006-09-13 0:06 UTC (permalink / raw) To: Paul Mackerras; +Cc: git Junio C Hamano <junkio@cox.net> writes: > 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. Perhaps this would fix it? I am at work now and I haven't looked at the logic aruond it too deeply (e.g. I do not know if this breaks the relative alternate or http specific cases, nor the same or similar breakages were there in these other cases in the original code to begin with) --- diff --git a/http-fetch.c b/http-fetch.c index fac1760..d870390 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -559,7 +559,13 @@ static void process_alternates_response( char *target = NULL; char *path; if (data[i] == '/') { - serverlen = strchr(base + 8, '/') - base; + /* This counts + * http://git.host/pub/scm/linux.git + * 1234567----here^ + * so strcpy(dst, base, serverlen) will + * copy up to "...git.host/" + */ + serverlen = strchr(base + 7, '/') - base; okay = 1; } else if (!memcmp(data + i, "../", 3)) { i += 3; @@ -586,7 +592,7 @@ static void process_alternates_response( /* skip 'objects' at end */ if (okay) { target = xmalloc(serverlen + posn - i - 6); - strlcpy(target, base, serverlen); + memcpy(target, base, serverlen); strlcpy(target + serverlen, data + i, posn - i - 6); if (get_verbosely) fprintf(stderr, ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: problem with http clone/pull 2006-09-13 0:06 ` Junio C Hamano @ 2006-09-13 0:39 ` Junio C Hamano 2006-09-13 1:08 ` Paul Mackerras 1 sibling, 0 replies; 6+ messages in thread From: Junio C Hamano @ 2006-09-13 0:39 UTC (permalink / raw) To: git Junio C Hamano <junkio@cox.net> writes: > Perhaps this would fix it? > > I am at work now and I haven't looked at the logic aruond it > too deeply (e.g. I do not know if this breaks the relative > alternate or http specific cases, nor the same or similar > breakages were there in these other cases in the original code > to begin with) Side note: > diff --git a/http-fetch.c b/http-fetch.c > index fac1760..d870390 100644 > --- a/http-fetch.c > +++ b/http-fetch.c > @@ -559,7 +559,13 @@ static void process_alternates_response( > char *target = NULL; > char *path; > if (data[i] == '/') { > - serverlen = strchr(base + 8, '/') - base; > + /* This counts > + * http://git.host/pub/scm/linux.git > + * 1234567----here^ > + * so strcpy(dst, base, serverlen) will > + * copy up to "...git.host/" > + */ > + serverlen = strchr(base + 7, '/') - base; > okay = 1; > } else if (!memcmp(data + i, "../", 3)) { > i += 3; The change between 7 and 8 does not really matter, because the hostname cannot be empty, and 8 was masking the breakage of this code; it was (perhaps deliberately) being sloppy to allow us to also skip over "protocol://" part for https:// case. Call it subtle if you want ;-). I think the right thing for this part to do would be something like this: diff --git a/http-fetch.c b/http-fetch.c index fac1760..c7545f2 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -559,8 +559,18 @@ static void process_alternates_response( char *target = NULL; char *path; if (data[i] == '/') { - serverlen = strchr(base + 8, '/') - base; - okay = 1; + /* This counts + * http://git.host/pub/scm/linux.git + * -----------here^ + * so memcpy(dst, base, serverlen) will + * copy up to "...git.host". + */ + const char *colon_ss = strstr(base,"://"); + if (colon_ss) { + serverlen = (strchr(colon_ss + 3, '/') + - base); + okay = 1; + } } else if (!memcmp(data + i, "../", 3)) { i += 3; serverlen = strlen(base); @@ -583,11 +593,13 @@ static void process_alternates_response( okay = 1; } } - /* skip 'objects' at end */ + /* skip "objects\n" at end */ if (okay) { target = xmalloc(serverlen + posn - i - 6); - strlcpy(target, base, serverlen); - strlcpy(target + serverlen, data + i, posn - i - 6); + memcpy(target, base, serverlen); + memcpy(target + serverlen, data + i, + posn - i - 7); + target[serverlen + posn - i - 7] = 0; if (get_verbosely) fprintf(stderr, "Also look at %s\n", target); ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: problem with http clone/pull 2006-09-13 0:06 ` Junio C Hamano 2006-09-13 0:39 ` Junio C Hamano @ 2006-09-13 1:08 ` Paul Mackerras 2006-09-13 19:03 ` Junio C Hamano 1 sibling, 1 reply; 6+ messages in thread From: Paul Mackerras @ 2006-09-13 1:08 UTC (permalink / raw) To: Junio C Hamano; +Cc: git Junio C Hamano writes: > Perhaps this would fix it? Yes, it works with that patch. Thanks. Paul. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: problem with http clone/pull 2006-09-13 1:08 ` Paul Mackerras @ 2006-09-13 19:03 ` Junio C Hamano 0 siblings, 0 replies; 6+ messages in thread From: Junio C Hamano @ 2006-09-13 19:03 UTC (permalink / raw) To: git; +Cc: Paul Mackerras I'll do 1.4.2.1 with a fix for this and push it out hopefully today. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2006-09-13 19:03 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2006-09-12 23:23 problem with http clone/pull Paul Mackerras 2006-09-12 23:43 ` Junio C Hamano 2006-09-13 0:06 ` Junio C Hamano 2006-09-13 0:39 ` Junio C Hamano 2006-09-13 1:08 ` Paul Mackerras 2006-09-13 19:03 ` Junio C Hamano
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox