* [BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322
@ 2007-06-12 16:13 Randal L. Schwartz
2007-06-12 20:03 ` Alex Riesen
2007-06-12 20:52 ` [PATCH] Do not use h_errno after connect(2): the function does not set it Alex Riesen
0 siblings, 2 replies; 11+ messages in thread
From: Randal L. Schwartz @ 2007-06-12 16:13 UTC (permalink / raw)
To: git
CC fetch-pack.o
fetch-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?
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <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!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322
2007-06-12 16:13 [BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322 Randal L. Schwartz
@ 2007-06-12 20:03 ` Alex Riesen
2007-06-12 20:52 ` [PATCH] Do not use h_errno after connect(2): the function does not set it Alex Riesen
1 sibling, 0 replies; 11+ messages in thread
From: Alex Riesen @ 2007-06-12 20:03 UTC (permalink / raw)
To: Randal L. Schwartz; +Cc: git
Randal L. Schwartz, Tue, Jun 12, 2007 18:13:40 +0200:
> 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?
Looks like. What have they got instead to clarify what h_errno means?
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] Do not use h_errno after connect(2): the function does not set it
2007-06-12 16:13 [BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322 Randal L. Schwartz
2007-06-12 20:03 ` Alex Riesen
@ 2007-06-12 20:52 ` Alex Riesen
2007-06-12 21:31 ` [PATCH] Add a local implementation of hstrerror for the system which do not have it Alex Riesen
1 sibling, 1 reply; 11+ messages in thread
From: Alex Riesen @ 2007-06-12 20:52 UTC (permalink / raw)
To: Randal L. Schwartz; +Cc: git, Junio C Hamano
Randal 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.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
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(-)
diff --git a/connect.c b/connect.c
index 7fab9c0..a5afd2a 100644
--- a/connect.c
+++ b/connect.c
@@ -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;
--
1.5.2.1.191.gc01a
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH] Add a local implementation of hstrerror for the system which do not have it
2007-06-12 20:52 ` [PATCH] Do not use h_errno after connect(2): the function does not set it Alex Riesen
@ 2007-06-12 21:31 ` Alex Riesen
2007-06-13 7:05 ` Johannes Sixt
2007-06-18 21:28 ` Brandon Casey
0 siblings, 2 replies; 11+ messages in thread
From: Alex Riesen @ 2007-06-12 21:31 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Randal L. Schwartz
The 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.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
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
diff --git a/Makefile b/Makefile
index 0f6540c..e054bc7 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/compat/hstrerror.c b/compat/hstrerror.c
new file mode 100644
index 0000000..c59b808
--- /dev/null
+++ b/compat/hstrerror.c
@@ -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;
+}
diff --git a/git-compat-util.h b/git-compat-util.h
index 6bd8987..b2ab3f8 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -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)
--
1.5.2.1.191.gc01a
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
2007-06-12 21:31 ` [PATCH] Add a local implementation of hstrerror for the system which do not have it Alex Riesen
@ 2007-06-13 7:05 ` Johannes Sixt
[not found] ` <81b0412b0706130051l570e6ab7y48d6eea8c6b2d97e@mail.gmail.com>
2007-06-18 21:28 ` Brandon Casey
1 sibling, 1 reply; 11+ messages in thread
From: Johannes Sixt @ 2007-06-13 7:05 UTC (permalink / raw)
To: git
Alex Riesen wrote:
> + 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH] Add a local implementation of hstrerror for the system which do not have it
[not found] ` <81b0412b0706130051l570e6ab7y48d6eea8c6b2d97e@mail.gmail.com>
@ 2007-06-13 18:54 ` Alex Riesen
2007-06-16 15:21 ` Randal L. Schwartz
0 siblings, 1 reply; 11+ messages in thread
From: Alex Riesen @ 2007-06-13 18:54 UTC (permalink / raw)
To: git; +Cc: Johannes Sixt, Junio C Hamano
The 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.
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
Makefile | 5 +++++
compat/hstrerror.c | 21 +++++++++++++++++++++
git-compat-util.h | 5 +++++
3 files changed, 31 insertions(+), 0 deletions(-)
create mode 100644 compat/hstrerror.c
diff --git a/Makefile b/Makefile
index 0f6540c..e054bc7 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/compat/hstrerror.c b/compat/hstrerror.c
new file mode 100644
index 0000000..069c555
--- /dev/null
+++ b/compat/hstrerror.c
@@ -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;
+}
diff --git a/git-compat-util.h b/git-compat-util.h
index 6bd8987..b2ab3f8 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -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)
--
1.5.2.1.270.g288d3f
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
2007-06-13 18:54 ` Alex Riesen
@ 2007-06-16 15:21 ` Randal L. Schwartz
0 siblings, 0 replies; 11+ messages in thread
From: Randal L. Schwartz @ 2007-06-16 15:21 UTC (permalink / raw)
To: Alex Riesen; +Cc: git, Johannes Sixt, Junio C Hamano
>>>>> "Alex" == Alex Riesen <raa.lkml@gmail.com> 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.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <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!
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
2007-06-12 21:31 ` [PATCH] Add a local implementation of hstrerror for the system which do not have it Alex Riesen
2007-06-13 7:05 ` Johannes Sixt
@ 2007-06-18 21:28 ` Brandon Casey
2007-06-18 21:34 ` Brandon Casey
2007-06-18 21:37 ` Alex Riesen
1 sibling, 2 replies; 11+ messages in thread
From: Brandon Casey @ 2007-06-18 21:28 UTC (permalink / raw)
To: Alex Riesen; +Cc: git, Junio C Hamano, Randal L. Schwartz
Alex Riesen wrote:
> The 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.
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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
2007-06-18 21:28 ` Brandon Casey
@ 2007-06-18 21:34 ` Brandon Casey
2007-06-18 21:37 ` Alex Riesen
1 sibling, 0 replies; 11+ messages in thread
From: Brandon Casey @ 2007-06-18 21:34 UTC (permalink / raw)
To: Alex Riesen; +Cc: git, Junio C Hamano, Randal L. Schwartz
Brandon Casey wrote:
> Alex Riesen wrote:
>> The 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.
>
> 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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
2007-06-18 21:28 ` Brandon Casey
2007-06-18 21:34 ` Brandon Casey
@ 2007-06-18 21:37 ` Alex Riesen
2007-06-18 21:53 ` Brandon Casey
1 sibling, 1 reply; 11+ messages in thread
From: Alex Riesen @ 2007-06-18 21:37 UTC (permalink / raw)
To: Brandon Casey; +Cc: git, Junio C Hamano, Randal L. Schwartz
Brandon Casey, Mon, Jun 18, 2007 23:28:10 +0200:
> Alex Riesen wrote:
> >The 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.
>
> 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.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it
2007-06-18 21:37 ` Alex Riesen
@ 2007-06-18 21:53 ` Brandon Casey
0 siblings, 0 replies; 11+ messages in thread
From: Brandon Casey @ 2007-06-18 21:53 UTC (permalink / raw)
To: Alex Riesen; +Cc: git, Junio C Hamano, Randal L. Schwartz
Alex Riesen wrote:
> Brandon Casey, Mon, Jun 18, 2007 23:28:10 +0200:
>> Alex Riesen wrote:
>>> The 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.
>> 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.
I see, right, just the NO_IPV6 case.
-brandon
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2007-06-18 21:54 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-12 16:13 [BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322 Randal L. Schwartz
2007-06-12 20:03 ` Alex Riesen
2007-06-12 20:52 ` [PATCH] Do not use h_errno after connect(2): the function does not set it Alex Riesen
2007-06-12 21:31 ` [PATCH] Add a local implementation of hstrerror for the system which do not have it Alex Riesen
2007-06-13 7:05 ` Johannes Sixt
[not found] ` <81b0412b0706130051l570e6ab7y48d6eea8c6b2d97e@mail.gmail.com>
2007-06-13 18:54 ` Alex Riesen
2007-06-16 15:21 ` Randal L. Schwartz
2007-06-18 21:28 ` Brandon Casey
2007-06-18 21:34 ` Brandon Casey
2007-06-18 21:37 ` Alex Riesen
2007-06-18 21:53 ` Brandon Casey
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).