You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Jon Travis <jt...@covalent.net> on 2002/04/24 20:22:23 UTC

Solaris binary compatability bug

I'm having a small problem with binary compatability between Solaris 2.6
and a particular Solaris 8 box that I have.  If I build a simple program
on a 2.6 box and call:

apr_sockaddr_info_get(..., "255.255.255.255", ...) 

It works fine on the 2.6 box, but fails on the 8.x box.  There is a 
check in the configure stage which defines GETHOSTBYNAME_HANDLES_NAS --
this succeeds on 2.6, and fails on 8.x (obviously not binary compatable.)

There is a way in which we can fix this:  Why don't we _always_ run the
segment of code in sa_common.c (~ line 420) where we do a strspn to see
if we are dealing with dotted-quad notation?   

-- Jon


Re: Solaris binary compatability bug

Posted by Jon Travis <jt...@covalent.net>.
Here's the patch which rips out the configure macros and the ifdefs
in sa_common.c.

-- Jon


Index: configure.in
===================================================================
RCS file: /home/cvspublic/apr/configure.in,v
retrieving revision 1.425
diff -u -u -r1.425 configure.in
--- configure.in	4 Apr 2002 21:35:43 -0000	1.425
+++ configure.in	24 Apr 2002 18:56:00 -0000
@@ -1519,8 +1519,6 @@
 
 APR_CHECK_SOCKADDR_SA_LEN
 
-APR_CHECK_GETHOSTBYNAME_NAS
-
 dnl Check the types only if we have gethostbyname_r
 if test "$ac_cv_func_gethostbyname_r" = "yes"; then
     APR_CHECK_GETHOSTBYNAME_R_STYLE
Index: build/apr_network.m4
===================================================================
RCS file: /home/cvspublic/apr/build/apr_network.m4,v
retrieving revision 1.15
diff -u -u -r1.15 apr_network.m4
--- build/apr_network.m4	24 Mar 2002 16:01:33 -0000	1.15
+++ build/apr_network.m4	24 Apr 2002 18:56:00 -0000
@@ -170,53 +170,6 @@
 fi
 ])
 
-
-dnl
-dnl check for gethostbyname() which handles numeric address strings
-dnl
-AC_DEFUN(APR_CHECK_GETHOSTBYNAME_NAS,[
-  AC_CACHE_CHECK(for gethostbyname() which handles numeric address strings, ac_cv_gethostbyname_nas,[
-  AC_TRY_RUN( [
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
-void main(void) {
-    struct hostent *he = gethostbyname("127.0.0.1");
-    if (he == NULL) {
-        exit(1);
-    }
-    he = gethostbyname("255.255.255.255");
-    if (he == NULL) {
-        exit(1);
-    }
-    else {
-        exit(0);
-    }
-}
-],[
-  ac_cv_gethostbyname_nas="yes"
-],[
-  ac_cv_gethostbyname_nas="no"
-],[
-  ac_cv_gethostbyname_nas="yes"
-])])
-if test "$ac_cv_gethostbyname_nas" = "yes"; then
-  AC_DEFINE(GETHOSTBYNAME_HANDLES_NAS, 1, [Define if gethostbyname() handles nnn.nnn.nnn.nnn])
-fi
-])
-
 dnl
 dnl Checks the definition of gethostbyname_r and gethostbyaddr_r
 dnl which are different for glibc, solaris and assorted other operating
Index: network_io/unix/sa_common.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/unix/sa_common.c,v
retrieving revision 1.54
diff -u -u -r1.54 sa_common.c
--- network_io/unix/sa_common.c	1 Apr 2002 14:13:45 -0000	1.54
+++ network_io/unix/sa_common.c	24 Apr 2002 18:56:01 -0000
@@ -417,7 +417,6 @@
             family = APR_INET; /* we don't support IPv6 here */
         }
 
-#ifndef GETHOSTBYNAME_HANDLES_NAS
         if (*hostname >= '0' && *hostname <= '9' &&
             strspn(hostname, "0123456789.") == strlen(hostname)) {
             struct in_addr ipaddr;
@@ -426,7 +425,6 @@
             save_addrinfo(p, *sa, ipaddr, port);
         }
         else {
-#endif
 #if APR_HAS_THREADS && !defined(GETHOSTBYNAME_IS_THREAD_SAFE) && \
     defined(HAVE_GETHOSTBYNAME_R) && !defined(BEOS)
 #if defined(GETHOSTBYNAME_R_HOSTENT_DATA)
@@ -474,9 +472,7 @@
                           port);
             ++curaddr;
         }
-#ifndef GETHOSTBYNAME_HANDLES_NAS
         }
-#endif
     }
     else {
         (*sa)->pool = p;

Re: Solaris binary compatability bug

Posted by Jim Jagielski <ji...@jaguNET.com>.
At 11:22 AM -0700 4/24/02, Jon Travis wrote:
>I'm having a small problem with binary compatability between Solaris 2.6
>and a particular Solaris 8 box that I have.  If I build a simple program
>on a 2.6 box and call:
>
>apr_sockaddr_info_get(..., "255.255.255.255", ...)
>
>It works fine on the 2.6 box, but fails on the 8.x box.  There is a
>check in the configure stage which defines GETHOSTBYNAME_HANDLES_NAS --
>this succeeds on 2.6, and fails on 8.x (obviously not binary compatable.)
>
>There is a way in which we can fix this:  Why don't we _always_ run the
>segment of code in sa_common.c (~ line 420) where we do a strspn to see
>if we are dealing with dotted-quad notation?  
>

Makes sense...
-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
      "A society that will trade a little liberty for a little order
             will lose both and deserve neither" - T.Jefferson

Re: Solaris binary compatability bug

Posted by Jeff Trawick <tr...@attglobal.net>.
Jon Travis <jt...@covalent.net> writes:

> I'm having a small problem with binary compatability between Solaris 2.6
> and a particular Solaris 8 box that I have.  If I build a simple program
> on a 2.6 box and call:
> 
> apr_sockaddr_info_get(..., "255.255.255.255", ...) 
> 
> It works fine on the 2.6 box, but fails on the 8.x box.  There is a 
> check in the configure stage which defines GETHOSTBYNAME_HANDLES_NAS --
> this succeeds on 2.6, and fails on 8.x (obviously not binary compatable.)

FYI... works on my Solaris 8 box...

> There is a way in which we can fix this:  Why don't we _always_ run the
> segment of code in sa_common.c (~ line 420) where we do a strspn to see
> if we are dealing with dotted-quad notation?   

fair enough (+0.9)...  we can zap the configure test and always handle
that part of processing...

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...