* compile error in Git v2.7.0-rc0 @ 2015-12-14 20:28 johan defries 2015-12-14 20:35 ` Junio C Hamano 0 siblings, 1 reply; 5+ messages in thread From: johan defries @ 2015-12-14 20:28 UTC (permalink / raw) To: git, gitter.spiros Probably because I have NO_IPV6 defined. ident.c: In function ‘canonical_name’: ident.c:89:37: error: ‘buf’ undeclared (first use in this function) struct hostent *he = gethostbyname(buf); ^ ident.c:89:37: note: each undeclared identifier is reported only once for each function it appears in make: *** [ident.o] Fout 1 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: compile error in Git v2.7.0-rc0 2015-12-14 20:28 compile error in Git v2.7.0-rc0 johan defries @ 2015-12-14 20:35 ` Junio C Hamano 2015-12-14 20:46 ` Jeff King 0 siblings, 1 reply; 5+ messages in thread From: Junio C Hamano @ 2015-12-14 20:35 UTC (permalink / raw) To: johan defries; +Cc: git, gitter.spiros johan defries <johandefries@gmail.com> writes: > Probably because I have NO_IPV6 defined. > > ident.c: In function ‘canonical_name’: > ident.c:89:37: error: ‘buf’ undeclared (first use in this function) > struct hostent *he = gethostbyname(buf); > ^ > ident.c:89:37: note: each undeclared identifier is reported only once > for each function it appears in > make: *** [ident.o] Fout 1 Thanks. This should perhaps do? ident.c | 1 + 1 file changed, 1 insertion(+) diff --git a/ident.c b/ident.c index 4e7f99d..2900879 100644 --- a/ident.c +++ b/ident.c @@ -86,6 +86,7 @@ static int canonical_name(const char *host, struct strbuf *out) freeaddrinfo(ai); } #else + char buf[1024]; struct hostent *he = gethostbyname(buf); if (he && strchr(he->h_name, '.')) { strbuf_addstr(out, he->h_name); ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: compile error in Git v2.7.0-rc0 2015-12-14 20:35 ` Junio C Hamano @ 2015-12-14 20:46 ` Jeff King 2015-12-14 20:52 ` Jeff King 0 siblings, 1 reply; 5+ messages in thread From: Jeff King @ 2015-12-14 20:46 UTC (permalink / raw) To: Junio C Hamano; +Cc: johan defries, git, gitter.spiros On Mon, Dec 14, 2015 at 12:35:25PM -0800, Junio C Hamano wrote: > johan defries <johandefries@gmail.com> writes: > > > Probably because I have NO_IPV6 defined. > > > > ident.c: In function ‘canonical_name’: > > ident.c:89:37: error: ‘buf’ undeclared (first use in this function) > > struct hostent *he = gethostbyname(buf); > > ^ > > ident.c:89:37: note: each undeclared identifier is reported only once > > for each function it appears in > > make: *** [ident.o] Fout 1 > > Thanks. This should perhaps do? > > ident.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/ident.c b/ident.c > index 4e7f99d..2900879 100644 > --- a/ident.c > +++ b/ident.c > @@ -86,6 +86,7 @@ static int canonical_name(const char *host, struct strbuf *out) > freeaddrinfo(ai); > } > #else > + char buf[1024]; > struct hostent *he = gethostbyname(buf); > if (he && strchr(he->h_name, '.')) { > strbuf_addstr(out, he->h_name); Whoops. Looks like we didn't test the NO_IPV6 code path. I don't think that fix is right, though. We should be passing "host" to gethostbyname. -Peff ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: compile error in Git v2.7.0-rc0 2015-12-14 20:46 ` Jeff King @ 2015-12-14 20:52 ` Jeff King 2015-12-14 21:11 ` Junio C Hamano 0 siblings, 1 reply; 5+ messages in thread From: Jeff King @ 2015-12-14 20:52 UTC (permalink / raw) To: Junio C Hamano; +Cc: johan defries, git, gitter.spiros On Mon, Dec 14, 2015 at 03:46:25PM -0500, Jeff King wrote: > I don't think that fix is right, though. We should be passing "host" to > gethostbyname. Here it is in patch form. It can go on top of ep/ident-with-getaddrinfo. -- >8 -- Subject: [PATCH] ident: fix undefined variable when NO_IPV6 is set Commit 00bce77 (ident.c: add support for IPv6, 2015-11-27) moved the "gethostbyname" call out of "add_domainname" and into the helper function "canonical_name". But when moving the code, it forgot that the "buf" variable is passed as "host" in the helper. Reported-by: johan defries <johandefries@gmail.com> Signed-off-by: Jeff King <peff@peff.net> --- ident.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ident.c b/ident.c index 4e7f99d..00a62e0 100644 --- a/ident.c +++ b/ident.c @@ -86,7 +86,7 @@ static int canonical_name(const char *host, struct strbuf *out) freeaddrinfo(ai); } #else - struct hostent *he = gethostbyname(buf); + struct hostent *he = gethostbyname(host); if (he && strchr(he->h_name, '.')) { strbuf_addstr(out, he->h_name); status = 0; -- 2.7.0.rc0.348.g8e7037f ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: compile error in Git v2.7.0-rc0 2015-12-14 20:52 ` Jeff King @ 2015-12-14 21:11 ` Junio C Hamano 0 siblings, 0 replies; 5+ messages in thread From: Junio C Hamano @ 2015-12-14 21:11 UTC (permalink / raw) To: Jeff King; +Cc: johan defries, Git Mailing List, Elia Pinto On Mon, Dec 14, 2015 at 12:52 PM, Jeff King <peff@peff.net> wrote: > On Mon, Dec 14, 2015 at 03:46:25PM -0500, Jeff King wrote: > >> I don't think that fix is right, though. We should be passing "host" to >> gethostbyname. > > Here it is in patch form. It can go on top of ep/ident-with-getaddrinfo. Thanks. I recall you were looking for a brown-paper-bag earlier. When you are done with it, could you pass it to me ;-)? ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-12-14 21:11 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-12-14 20:28 compile error in Git v2.7.0-rc0 johan defries 2015-12-14 20:35 ` Junio C Hamano 2015-12-14 20:46 ` Jeff King 2015-12-14 20:52 ` Jeff King 2015-12-14 21:11 ` 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; as well as URLs for NNTP newsgroup(s).