{"thread":{"id":"8573","subject":"[BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322","startedAt":"2007-06-12T16:13:40Z","lastAt":"2007-06-18T21:53:24Z","messageCount":11,"participants":["Randal L. Schwartz","Alex Riesen","Johannes Sixt","Brandon Casey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"44842","messageId":"86ejkh40cr.fsf@blue.stonehenge.com","threadId":"8573","inReplyTo":null,"subject":"[BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-06-12T16:13:40Z","receivedAt":"2007-06-12T16:13:40Z","isPatch":false,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":"\n    CC fetch-pack.o\nfetch-pack.c: In function `get_pack':\nfetch-pack.c:532: warning: int format, pid_t arg (arg 3)\n    LINK git-fetch-pack\nUndefined                       first referenced\n symbol                             in file\nhstrerror                           libgit.a(connect.o)\nld: fatal: Symbol referencing errors. No output written to git-fetch-pack\ncollect2: ld returned 1 exit status\nmake: *** [git-fetch-pack] Error 1\n\nI suspect this broke in ba505322 when connect.c added hsterror().\n\nYes, bumping to g18bece works fine.  So it looks like we need a compat\nhsterror(), or it should be removed or ifdef'ed somehow.  Paging Alex Riesen?\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"44866","messageId":"20070612200307.GB2459@steel.home","threadId":"8573","inReplyTo":"86ejkh40cr.fsf@blue.stonehenge.com","subject":"Re: [BUG] 75d8ff1 fails on SunOS 5.9 (missing hsterror) from ba505322","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-12T20:03:07Z","receivedAt":"2007-06-12T20:03:07Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Randal L. Schwartz, Tue, Jun 12, 2007 18:13:40 +0200:\n> I suspect this broke in ba505322 when connect.c added hsterror().\n> \n> Yes, bumping to g18bece works fine.  So it looks like we need a compat\n> hsterror(), or it should be removed or ifdef'ed somehow.  Paging Alex Riesen?\n\nLooks like. What have they got instead to clarify what h_errno means?\n"},{"id":"44870","messageId":"20070612205210.GC2459@steel.home","threadId":"8573","inReplyTo":"86ejkh40cr.fsf@blue.stonehenge.com","subject":"[PATCH] Do not use h_errno after connect(2): the function does not set it","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-12T20:52:10Z","receivedAt":"2007-06-12T20:52:10Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Randal L. Schwartz noticed compilation problems on SunOS, which made\nme look at the code again. The thing is, h_errno is not used by\nconnect(2), it is only for functions from netdb.h, like gethostbyname.\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n---\n\nThis must fix your link problems (unless you want to use NO_IPV6=1,\nwhere another fix will be posted in a minute).\n\n connect.c |    6 ++----\n 1 files changed, 2 insertions(+), 4 deletions(-)\n\ndiff --git a/connect.c b/connect.c\nindex 7fab9c0..a5afd2a 100644\n--- a/connect.c\n+++ b/connect.c\n@@ -224,11 +224,10 @@ static int git_tcp_connect_sock(char *host, int flags)\n \t\t}\n \t\tif (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0) {\n \t\t\tsaved_errno = errno;\n-\t\t\tfprintf(stderr, \"%s[%d: %s]: net=%s, errno=%s\\n\",\n+\t\t\tfprintf(stderr, \"%s[%d: %s]: errno=%s\\n\",\n \t\t\t\thost,\n \t\t\t\tcnt,\n \t\t\t\tai_name(ai),\n-\t\t\t\thstrerror(h_errno),\n \t\t\t\tstrerror(saved_errno));\n \t\t\tclose(sockfd);\n \t\t\tsockfd = -1;\n@@ -315,11 +314,10 @@ static int git_tcp_connect_sock(char *host, int flags)\n \n \t\tif (connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {\n \t\t\tsaved_errno = errno;\n-\t\t\tfprintf(stderr, \"%s[%d: %s]: net=%s, errno=%s\\n\",\n+\t\t\tfprintf(stderr, \"%s[%d: %s]: errno=%s\\n\",\n \t\t\t\thost,\n \t\t\t\tcnt,\n \t\t\t\tinet_ntoa(*(struct in_addr *)&sa.sin_addr),\n-\t\t\t\thstrerror(h_errno),\n \t\t\t\tstrerror(saved_errno));\n \t\t\tclose(sockfd);\n \t\t\tsockfd = -1;\n-- \n1.5.2.1.191.gc01a\n"},{"id":"297583","messageId":"20070612213129.GD2459@steel.home","threadId":"8573","inReplyTo":"20070612205210.GC2459@steel.home","subject":"[PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-12T21:31:29Z","receivedAt":"2007-06-12T21:31:29Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"The function converts the value of h_errno (last error of name\nresolver library, see netdb.h). One of systems which supposedly do\nnot have the function is SunOS. POSIX does not mandate its presence.\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n---\n\nRandal, you seem to have access to a SunOS system. Could you try to\ncompile your git with NO_IPV6 (if you already applied the previous\nfix, which removed superflous calls to hstrerror), and than again\nwithout it (just to be sure)?\n\n Makefile           |    5 +++++\n compat/hstrerror.c |   21 +++++++++++++++++++++\n git-compat-util.h  |    5 +++++\n 3 files changed, 31 insertions(+), 0 deletions(-)\n create mode 100644 compat/hstrerror.c\n\ndiff --git a/Makefile b/Makefile\nindex 0f6540c..e054bc7 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -410,6 +410,7 @@ ifeq ($(uname_S),SunOS)\n \tNEEDS_NSL = YesPlease\n \tSHELL_PATH = /bin/bash\n \tNO_STRCASESTR = YesPlease\n+\tNO_HSTRERROR = YesPlease\n \tifeq ($(uname_R),5.8)\n \t\tNEEDS_LIBICONV = YesPlease\n \t\tNO_UNSETENV = YesPlease\n@@ -654,6 +655,10 @@ endif\n ifdef NO_PERL_MAKEMAKER\n \texport NO_PERL_MAKEMAKER\n endif\n+ifdef NO_HSTRERROR\n+\tCOMPAT_CFLAGS += -DNO_HSTRERROR\n+\tCOMPAT_OBJS += compat/hstrerror.o\n+endif\n \n ifeq ($(TCLTK_PATH),)\n NO_TCLTK=NoThanks\ndiff --git a/compat/hstrerror.c b/compat/hstrerror.c\nnew file mode 100644\nindex 0000000..c59b808\n--- /dev/null\n+++ b/compat/hstrerror.c\n@@ -0,0 +1,21 @@\n+#include <string.h>\n+#include <stdio.h>\n+#include <netdb.h>\n+\n+const char *githstrerror(int err)\n+{\n+\tstatic char buffer[32];\n+\tswitch (err)\n+\t{\n+\tcase HOST_NOT_FOUND:\n+\t\treturn \"Authoritative answer: host not found\";\n+\tcase NO_DATA:\n+\t\treturn \"Valid name, no data record of requested type\";\n+\tcase NO_RECOVERY:\n+\t\treturn \"Non recoverable errors, FORMERR, REFUSED, NOTIMP\";\n+\tcase TRY_AGAIN:\n+\t\treturn \"Non-authoritative \\\"host not found\\\", or SERVERFAIL\";\n+\t}\n+\tsprintf(buffer, \"Name resolution error %d\", err);\n+\treturn buffer;\n+}\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 6bd8987..b2ab3f8 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -167,6 +167,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t);\n extern uintmax_t gitstrtoumax(const char *, char **, int);\n #endif\n \n+#ifdef NO_HSTRERROR\n+#define hstrerror githstrerror\n+extern const char *githstrerror(int herror);\n+#endif\n+\n extern void release_pack_memory(size_t, int);\n \n static inline char* xstrdup(const char *str)\n-- \n1.5.2.1.191.gc01a\n"},{"id":"44895","messageId":"466F971F.C74761E2@eudaptics.com","threadId":"8573","inReplyTo":"20070612213129.GD2459@steel.home","subject":"Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Johannes Sixt","fromEmail":"j.sixt@eudaptics.com","sentAt":"2007-06-13T07:05:03Z","receivedAt":"2007-06-13T07:05:03Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Alex Riesen wrote:\n> +       static char buffer[32];\n> ...\n> +       sprintf(buffer, \"Name resolution error %d\", err);\n\nI don't think it's a problem for any current implementation, but it\nwould be better to err on the conservative side: The buffer should be at\nleast 44 chars wide to account for 20 digit negative numbers (thats the\nmaximum if int is 64 bits wide).\n\n-- Hannes\n"},{"id":"44987","messageId":"20070613185432.GA3412@steel.home","threadId":"8573","inReplyTo":"81b0412b0706130051l570e6ab7y48d6eea8c6b2d97e@mail.gmail.com","subject":"[PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-13T18:54:32Z","receivedAt":"2007-06-13T18:54:32Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"The function converts the value of h_errno (last error of name\nresolver library, see netdb.h).\nOne of systems which supposedly do not have the function is SunOS.\nPOSIX does not mandate its presence.\n\nSigned-off-by: Alex Riesen <raa.lkml@gmail.com>\n---\n Makefile           |    5 +++++\n compat/hstrerror.c |   21 +++++++++++++++++++++\n git-compat-util.h  |    5 +++++\n 3 files changed, 31 insertions(+), 0 deletions(-)\n create mode 100644 compat/hstrerror.c\n\ndiff --git a/Makefile b/Makefile\nindex 0f6540c..e054bc7 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -410,6 +410,7 @@ ifeq ($(uname_S),SunOS)\n \tNEEDS_NSL = YesPlease\n \tSHELL_PATH = /bin/bash\n \tNO_STRCASESTR = YesPlease\n+\tNO_HSTRERROR = YesPlease\n \tifeq ($(uname_R),5.8)\n \t\tNEEDS_LIBICONV = YesPlease\n \t\tNO_UNSETENV = YesPlease\n@@ -654,6 +655,10 @@ endif\n ifdef NO_PERL_MAKEMAKER\n \texport NO_PERL_MAKEMAKER\n endif\n+ifdef NO_HSTRERROR\n+\tCOMPAT_CFLAGS += -DNO_HSTRERROR\n+\tCOMPAT_OBJS += compat/hstrerror.o\n+endif\n \n ifeq ($(TCLTK_PATH),)\n NO_TCLTK=NoThanks\ndiff --git a/compat/hstrerror.c b/compat/hstrerror.c\nnew file mode 100644\nindex 0000000..069c555\n--- /dev/null\n+++ b/compat/hstrerror.c\n@@ -0,0 +1,21 @@\n+#include <string.h>\n+#include <stdio.h>\n+#include <netdb.h>\n+\n+const char *githstrerror(int err)\n+{\n+\tstatic char buffer[48];\n+\tswitch (err)\n+\t{\n+\tcase HOST_NOT_FOUND:\n+\t\treturn \"Authoritative answer: host not found\";\n+\tcase NO_DATA:\n+\t\treturn \"Valid name, no data record of requested type\";\n+\tcase NO_RECOVERY:\n+\t\treturn \"Non recoverable errors, FORMERR, REFUSED, NOTIMP\";\n+\tcase TRY_AGAIN:\n+\t\treturn \"Non-authoritative \\\"host not found\\\", or SERVERFAIL\";\n+\t}\n+\tsprintf(buffer, \"Name resolution error %d\", err);\n+\treturn buffer;\n+}\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 6bd8987..b2ab3f8 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -167,6 +167,11 @@ extern size_t gitstrlcpy(char *, const char *, size_t);\n extern uintmax_t gitstrtoumax(const char *, char **, int);\n #endif\n \n+#ifdef NO_HSTRERROR\n+#define hstrerror githstrerror\n+extern const char *githstrerror(int herror);\n+#endif\n+\n extern void release_pack_memory(size_t, int);\n \n static inline char* xstrdup(const char *str)\n-- \n1.5.2.1.270.g288d3f\n"},{"id":"45162","messageId":"86tzt7udq2.fsf@blue.stonehenge.com","threadId":"8573","inReplyTo":"20070613185432.GA3412@steel.home","subject":"Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Randal L. Schwartz","fromEmail":"merlyn@stonehenge.com","sentAt":"2007-06-16T15:21:41Z","receivedAt":"2007-06-16T15:21:41Z","isPatch":true,"sender":{"key":"merlyn@stonehenge.com","avatar":"https://gravatar.com/avatar/dc528d210743ff0333e6213f9ee7b33b23f1b7bc1f3c5a8c2d819074ecd7ab19?d=mp&s=160"},"body":">>>>> \"Alex\" == Alex Riesen <raa.lkml@gmail.com> writes:\n\nAlex> The function converts the value of h_errno (last error of name\nAlex> resolver library, see netdb.h).\nAlex> One of systems which supposedly do not have the function is SunOS.\nAlex> POSIX does not mandate its presence.\n\nThanks... 952c8c5 compiles and installs fine on sunos now.\n\n-- \nRandal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095\n<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>\nPerl/Unix/security consulting, Technical writing, Comedy, etc. etc.\nSee PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!\n"},{"id":"45285","messageId":"4676F8EA.1030305@nrlssc.navy.mil","threadId":"8573","inReplyTo":"20070612213129.GD2459@steel.home","subject":"Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2007-06-18T21:28:10Z","receivedAt":"2007-06-18T21:28:10Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Alex Riesen wrote:\n> The function converts the value of h_errno (last error of name\n> resolver library, see netdb.h). One of systems which supposedly do\n> not have the function is SunOS. POSIX does not mandate its presence.\n\nI saw a comment on another mailing list that hstrerror() is in the\nresolv library.\n\n    So adding -lresolv should do it.\n\nA quick compile works for my test program.\n\n-brandon\n"},{"id":"45287","messageId":"4676FA59.5040602@nrlssc.navy.mil","threadId":"8573","inReplyTo":"4676F8EA.1030305@nrlssc.navy.mil","subject":"Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2007-06-18T21:34:17Z","receivedAt":"2007-06-18T21:34:17Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Brandon Casey wrote:\n> Alex Riesen wrote:\n>> The function converts the value of h_errno (last error of name\n>> resolver library, see netdb.h). One of systems which supposedly do\n>> not have the function is SunOS. POSIX does not mandate its presence.\n> \n> I saw a comment on another mailing list that hstrerror() is in the\n> resolv library.\n> \n>    So adding -lresolv should do it.\n> \n> A quick compile works for my test program.\n\nHere's a SunOS5.9 man page for hstrerror:\n\nhttp://bama.ua.edu/cgi-bin/man-cgi?hstrerror+3RESOLV\n\nwhich shows:\n\n    cc [ flag ... ] file ... -lresolv  -lsocket  -lnsl [ library ... ]\n\n-brandon\n"},{"id":"45289","messageId":"20070618213749.GB16397@steel.home","threadId":"8573","inReplyTo":"4676F8EA.1030305@nrlssc.navy.mil","subject":"Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-06-18T21:37:49Z","receivedAt":"2007-06-18T21:37:49Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Brandon Casey, Mon, Jun 18, 2007 23:28:10 +0200:\n> Alex Riesen wrote:\n> >The function converts the value of h_errno (last error of name\n> >resolver library, see netdb.h). One of systems which supposedly do\n> >not have the function is SunOS. POSIX does not mandate its presence.\n> \n> I saw a comment on another mailing list that hstrerror() is in the\n> resolv library.\n> \n>    So adding -lresolv should do it.\n> \n> A quick compile works for my test program.\n> \n\nAh-ha. Good to know, thanks!\n\nStill, the patch is correct: no need for hstrerror there.\n"},{"id":"45291","messageId":"4676FED4.70905@nrlssc.navy.mil","threadId":"8573","inReplyTo":"20070618213749.GB16397@steel.home","subject":"Re: [PATCH] Add a local implementation of hstrerror for the system which do not have it","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2007-06-18T21:53:24Z","receivedAt":"2007-06-18T21:53:24Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Alex Riesen wrote:\n> Brandon Casey, Mon, Jun 18, 2007 23:28:10 +0200:\n>> Alex Riesen wrote:\n>>> The function converts the value of h_errno (last error of name\n>>> resolver library, see netdb.h). One of systems which supposedly do\n>>> not have the function is SunOS. POSIX does not mandate its presence.\n>> I saw a comment on another mailing list that hstrerror() is in the\n>> resolv library.\n>>\n>>    So adding -lresolv should do it.\n>>\n>> A quick compile works for my test program.\n>>\n> \n> Ah-ha. Good to know, thanks!\n> \n> Still, the patch is correct: no need for hstrerror there.\n\nI see, right, just the NO_IPV6 case.\n\n-brandon\n"}]}