75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322
CC fetch-pack.ofetch-pack.c: In function `get_pack':
fetch-pack.c:532: warning: int format, pid_t arg (arg 3)
LINK git-fetch-pack
Undefined first referenced
symbol in file
hstrerror libgit.a(connect.o)
ld: fatal: Symbol referencing errors. No output written to git-fetch-pack
collect2: ld returned 1 exit status
make: *** [git-fetch-pack] Error 1
I suspect this broke in ba505322 when connect.c added hsterror().
Yes, bumping to g18bece works fine. So it looks like we need a compat hsterror(), or it should be removed or ifdef'ed somehow. Paging Alex Riesen?
Signature · 4 lines
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[email protected]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Randal L. Schwartz, Tue, Jun 12, 2007 18:13:40 +0200:
Quoted 4 lines
I suspect this broke in
ba505322whenconnect.caddedhsterror().Yes, bumping to g18bece works fine. So it looks like we need a compat
hsterror(), or it should be removed or ifdef'ed somehow. Paging Alex Riesen?
Looks like. What have they got instead to clarify what h_errno means?
PATCH 1/1 Do not use h_errno after connect(2): the function does not set it
In reply to Randal L. SchwartzRandal L. Schwartz noticed compilation problems on SunOS, which made me look at the code again. The thing is, h_errno is not used by connect(2), it is only for functions from netdb.h, like gethostbyname.
---
This must fix your link problems (unless you want to use NO_IPV6=1, where another fix will be posted in a minute).
connect.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
connect.c +2 -4
@@ -224,11 +224,10 @@ static int git_tcp_connect_sock(char *host, int flags) }if (connect (sockfd, ai->ai_addr, ai->ai_addrlen) <0 ) { saved_errno = errno; -fprintf (stderr,"%s[%d: %s]: net=%s, errno=%s\n" , +fprintf (stderr,"%s[%d: %s]: errno=%s\n" , host, cnt,ai_name (ai), -hstrerror (h_errno),strerror (saved_errno));close (sockfd); sockfd =-1 ;
@@ -315,11 +314,10 @@ static int git_tcp_connect_sock(char *host, int flags)if (connect (sockfd, (struct sockaddr *)&sa,sizeof sa) <0 ) { saved_errno = errno; -fprintf (stderr,"%s[%d: %s]: net=%s, errno=%s\n" , +fprintf (stderr,"%s[%d: %s]: errno=%s\n" , host, cnt,inet_ntoa (*(struct in_addr *)&sa.sin_addr), -hstrerror (h_errno),strerror (saved_errno));close (sockfd); sockfd =-1 ;
Signature · 1 line
1.5.2.1.191.gc01a
Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
In reply to Alex Riesencompat/hstrerror.c line 19
Quoted 3 lines · Alex Riesen
compat/hstrerror.c new file +2
-0+static char buffer[32 ]; +sprintf (buffer,"Name resolution error %d" , err);
I don't think it's a problem for any current implementation, but it would be better to err on the conservative side: The buffer should be at least 44 chars wide to account for 20 digit negative numbers (thats the maximum if int is 64 bits wide).
-- Hannes
PATCH 1/1 Add a local implementation of hstrerror for the system which do not have it
In reply to a message not in the archiveThe function converts the value of h_errno (last error of name resolver library, see netdb.h).
One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence.
--- Makefile | 5 +++++ compat/hstrerror.c | 21 +++++++++++++++++++++ git-compat-util.h | 5 +++++ 3 files changed, 31 insertions(+), 0 deletions(-) create mode 100644 compat/hstrerror.c
Makefile +5 -0
@@ -410,6 +410,7 @@ ifeq ($(uname_S),SunOS) NEEDS_NSL = YesPlease SHELL_PATH = /bin/bash NO_STRCASESTR = YesPlease + NO_HSTRERROR = YesPlease ifeq ($(uname_R),5.8) NEEDS_LIBICONV = YesPlease NO_UNSETENV = YesPlease
@@ -654,6 +655,10 @@ endif ifdef NO_PERL_MAKEMAKER export NO_PERL_MAKEMAKER endif +ifdef NO_HSTRERROR + COMPAT_CFLAGS += -DNO_HSTRERROR + COMPAT_OBJS += compat/hstrerror.o +endif ifeq ($(TCLTK_PATH),) NO_TCLTK=NoThanks
compat/hstrerror.c new file +21 -0
@@ -0,0 +1,21 @@ +#include <string.h> +#include <stdio.h> +#include <netdb.h> + +const char *githstrerror (int err) +{ +static char buffer[48 ]; +switch (err) + { +case HOST_NOT_FOUND : +return "Authoritative answer: host not found" ; +case NO_DATA : +return "Valid name, no data record of requested type" ; +case NO_RECOVERY : +return "Non recoverable errors, FORMERR, REFUSED, NOTIMP" ; +case TRY_AGAIN : +return "Non-authoritative \"host not found\", or SERVERFAIL" ; + } +sprintf (buffer,"Name resolution error %d" , err); +return buffer; +}
git-compat-util.h +5 -0
@@ -167,6 +167,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t);extern uintmax_t gitstrtoumax (const char *,char **,int );#endif +#ifdef NO_HSTRERROR +#define hstrerror githstrerror +extern const char *githstrerror (int herror); +#endif +extern void release_pack_memory (size_t ,int );static inline char *xstrdup (const char *str)
Signature · 1 line
1.5.2.1.270.g288d3f
Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Alex" == Alex Riesen <[email protected]> writes:
Alex> The function converts the value of h_errno (last error of name Alex> resolver library, see netdb.h).
Alex> One of systems which supposedly do not have the function is SunOS. Alex> POSIX does not mandate its presence.
Thanks... 952c8c5 compiles and installs fine on sunos now.
Signature · 4 lines
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[email protected]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
In reply to Alex RiesenQuoted 3 lines · Alex Riesen
The function converts the value of
h_errno(last error of name resolver library, seenetdb.h). One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence.
I saw a comment on another mailing list that hstrerror() is in the resolv library.
So adding -lresolv should do it.
A quick compile works for my test program.
-brandon
Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
Brandon Casey, Mon, Jun 18, 2007 23:28:10 +0200:
Quoted 5 lines
Quoted 3 lines · Alex Riesen
The function converts the value of
h_errno(last error of name resolver library, seenetdb.h). One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence.
Quoted 7 lines
I saw a comment on another mailing list that
hstrerror()is in the resolv library.So adding -lresolv should do it.
A quick compile works for my test program.
Ah-ha. Good to know, thanks!
Still, the patch is correct: no need for hstrerror there.
Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
Quoted 8 lines · Alex Riesen
Brandon Casey, Mon, Jun 18, 2007 23:28:10 +0200:
Quoted 7 lines
Quoted 3 lines · Alex Riesen
The function converts the value of
h_errno(last error of name resolver library, seenetdb.h). One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence.I saw a comment on another mailing list that
hstrerror()is in the resolv library.
Quoted 8 lines
Quoted 4 lines
So adding -lresolv should do it.
A quick compile works for my test program.
Ah-ha. Good to know, thanks!
Still, the patch is correct: no need for hstrerror there.
I see, right, just the NO_IPV6 case.
-brandon
Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
In reply to Brandon CaseyQuoted 11 lines · Brandon Casey
Quoted 3 lines · Alex Riesen
The function converts the value of
h_errno(last error of name resolver library, seenetdb.h). One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence.I saw a comment on another mailing list that
hstrerror()is in the resolv library.So adding -lresolv should do it.
A quick compile works for my test program.
Here's a SunOS5.9 man page for hstrerror:
http://bama.ua.edu/cgi-bin/man-cgi?hstrerror+3RESOLV
which shows:
cc [ flag ... ] file ... -lresolv -lsocket -lnsl [ library ... ]
-brandon
PATCH 1/1 Add a local implementation of hstrerror for the system which do not have it
In reply to Alex RiesenThe function converts the value of h_errno (last error of name resolver library, see netdb.h). One of systems which supposedly do not have the function is SunOS. POSIX does not mandate its presence.
---
Randal, you seem to have access to a SunOS system. Could you try to compile your git with NO_IPV6 (if you already applied the previous fix, which removed superflous calls to hstrerror), and than again without it (just to be sure)?
Makefile | 5 +++++ compat/hstrerror.c | 21 +++++++++++++++++++++ git-compat-util.h | 5 +++++ 3 files changed, 31 insertions(+), 0 deletions(-) create mode 100644 compat/hstrerror.c
Makefile +5 -0
@@ -410,6 +410,7 @@ ifeq ($(uname_S),SunOS) NEEDS_NSL = YesPlease SHELL_PATH = /bin/bash NO_STRCASESTR = YesPlease + NO_HSTRERROR = YesPlease ifeq ($(uname_R),5.8) NEEDS_LIBICONV = YesPlease NO_UNSETENV = YesPlease
@@ -654,6 +655,10 @@ endif ifdef NO_PERL_MAKEMAKER export NO_PERL_MAKEMAKER endif +ifdef NO_HSTRERROR + COMPAT_CFLAGS += -DNO_HSTRERROR + COMPAT_OBJS += compat/hstrerror.o +endif ifeq ($(TCLTK_PATH),) NO_TCLTK=NoThanks
compat/hstrerror.c new file +21 -0
@@ -0,0 +1,21 @@ +#include <string.h> +#include <stdio.h> +#include <netdb.h> + +const char *githstrerror (int err) +{ +static char buffer[32 ]; +switch (err) + { +case HOST_NOT_FOUND : +return "Authoritative answer: host not found" ; +case NO_DATA : +return "Valid name, no data record of requested type" ; +case NO_RECOVERY : +return "Non recoverable errors, FORMERR, REFUSED, NOTIMP" ; +case TRY_AGAIN : +return "Non-authoritative \"host not found\", or SERVERFAIL" ; + } +sprintf (buffer,"Name resolution error %d" , err); +return buffer; +}
git-compat-util.h +5 -0
@@ -167,6 +167,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t);extern uintmax_t gitstrtoumax (const char *,char **,int );#endif +#ifdef NO_HSTRERROR +#define hstrerror githstrerror +extern const char *githstrerror (int herror); +#endif +extern void release_pack_memory (size_t ,int );static inline char *xstrdup (const char *str)
Signature · 1 line
1.5.2.1.191.gc01a