[ python-Bugs-991125 ] Make Problem on HPUX

SourceForge.net noreply at sourceforge.net
Fri Sep 3 15:59:24 CEST 2004


Bugs item #991125, was opened at 2004-07-14 15:49
Message generated for change (Comment added) made by plusk
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=991125&group_id=5470

Category: Installation
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Paul D. Lusk (plusk)
Assigned to: Nobody/Anonymous (nobody)
Summary: Make Problem on HPUX

Initial Comment:
Build of _socket fails:

In file included from /home/python/Python-
2.4a1/Modules/socketmodule.c:314:
/home/python/Python-2.4a1/Modules/getaddrinfo.c: In 
function `fake_gai_strerror':
/home/python/Python-2.4a1/Modules/getaddrinfo.c:204: 
`EAI_MAX' undeclared (first use in this function)
/home/python/Python-2.4a1/Modules/getaddrinfo.c:204: 
(Each undeclared identifier is reported only once
/home/python/Python-2.4a1/Modules/getaddrinfo.c:204: 
for each function it appears in.)
/home/python/Python-2.4a1/Modules/getaddrinfo.c: In 
function `fake_getaddrinfo':
/home/python/Python-2.4a1/Modules/getaddrinfo.c:282: 
`EAI_BADHINTS' undeclared (first use in this function)
/home/python/Python-2.4a1/Modules/getaddrinfo.c:283: 
`AI_MASK' undeclared (first use in this function)
/home/python/Python-2.4a1/Modules/getaddrinfo.c:373: 
`EAI_PROTOCOL' undeclared (first use in this function)

The problem seems to be that 

#include "addrinfo.h"

is in an #if 0 block in getaddrinfo.c

When that include is moved out of the #if 0
block, the _socket module compiles and 
make test does not show any errors.

System information:

uname -a
HP-UX voyager B.11.11 U 9000/800 3108770354 
unlimited-user license

The above problem occurs with both gcc and with
HP's C compiler.

----------------------------------------------------------------------

>Comment By: Paul D. Lusk (plusk)
Date: 2004-09-03 09:59

Message:
Logged In: YES 
user_id=1083789

Fixed in 2.4a3

----------------------------------------------------------------------

Comment By: Paul D. Lusk (plusk)
Date: 2004-08-05 10:55

Message:
Logged In: YES 
user_id=1083789

It is the final inet4 test failing. inet4 is 1. 

----------------------------------------------------------------------

Comment By: Sjoerd Mullender (sjoerd)
Date: 2004-08-05 10:14

Message:
Logged In: YES 
user_id=43607

Putting #include "addrinfo.h" outside the #if 0/#endif in
getaddrinfo.c.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-08-05 09:13

Message:
Logged In: YES 
user_id=21627

plusk, can you find out which of the "goto bad" statements
was taken, by running the program separately, and adding
printf calls? Historically, Python had to make these tests,
because many platforms indeed *have* a broken getaddrinfo.

sjoerd, in what way does exactly what fix the compilation
problem on Cygwin?

----------------------------------------------------------------------

Comment By: Sjoerd Mullender (sjoerd)
Date: 2004-08-05 08:59

Message:
Logged In: YES 
user_id=43607

This also fixes the compilation problem on Cygwin.  See bug
1001857.

----------------------------------------------------------------------

Comment By: Paul D. Lusk (plusk)
Date: 2004-08-05 08:25

Message:
Logged In: YES 
user_id=1083789

But configure thinks it's buggy:

configure:14229: checking getaddrinfo bug
configure:14332: gcc -o conftest -g -O2   conftest.c -lcl -
lnsl -lrt -ldld  -lpthread >&5
configure:14335: $? = 0
configure:14337: ./conftest
configure:14340: $? = 1
configure: program exited with status 1
configure: failed program was:
| #line 14236 "configure"
| /* confdefs.h.  */
|
| #define _GNU_SOURCE 1
| #define _NETBSD_SOURCE 1
| #define __BSD_VISIBLE 1
| #define _XOPEN_SOURCE 600
| #define _XOPEN_SOURCE_EXTENDED 1
| #define _POSIX_C_SOURCE 200112L
| #define STDC_HEADERS 1
| #define HAVE_SYS_TYPES_H 1
| #define HAVE_SYS_STAT_H 1
| #define HAVE_STDLIB_H 1
| #define HAVE_STRING_H 1
| #define HAVE_MEMORY_H 1
| #define HAVE_STRINGS_H 1
| #define HAVE_INTTYPES_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_DLFCN_H 1
| #define HAVE_FCNTL_H 1
| #define HAVE_GRP_H 1
| #define HAVE_LANGINFO_H 1
| #define HAVE_POLL_H 1
| #define HAVE_PTHREAD_H 1
| #define HAVE_STROPTS_H 1
| #define HAVE_TERMIOS_H 1
| #define HAVE_UNISTD_H 1
| #define HAVE_UTIME_H 1
| #define HAVE_SYS_BSDTTY_H 1
| #define HAVE_SYS_FILE_H 1
| #define HAVE_SYS_LOCK_H 1
| #define HAVE_SYS_MODEM_H 1
| #define HAVE_SYS_PARAM_H 1
| #define HAVE_SYS_POLL_H 1
| #define HAVE_SYS_SOCKET_H 1
| #define HAVE_SYS_TIME_H 1
| #define HAVE_SYS_TIMES_H 1
| #define HAVE_SYS_UN_H 1
| #define HAVE_SYS_UTSNAME_H 1
| #define HAVE_SYS_WAIT_H 1
| #define HAVE_TERM_H 1
| #define HAVE_SYS_RESOURCE_H 1
| #define HAVE_SYSEXITS_H 1
| #define HAVE_DIRENT_H 1
| #define MAJOR_IN_SYSMACROS 1
| #define _LARGEFILE_SOURCE 1
| #define _FILE_OFFSET_BITS 64
| #if defined(SCO_DS)
| #undef _OFF_T
| #endif
| #define RETSIGTYPE void
| #define SIZEOF_INT 4
| #define SIZEOF_LONG 4
| #define SIZEOF_VOID_P 4
| #define SIZEOF_SHORT 2
| #define SIZEOF_FLOAT 4
| #define SIZEOF_DOUBLE 8
| #define SIZEOF_FPOS_T 8
| #define HAVE_LONG_LONG 1
| #define SIZEOF_LONG_LONG 8
| #define SIZEOF_OFF_T 8
| #define HAVE_LARGEFILE_SUPPORT 1
| #define SIZEOF_TIME_T 4
| #define SIZEOF_PTHREAD_T 4
| #define HAVE_LIBDLD 1
| #define _REENTRANT 1
| #define WITH_THREAD 1
| #define _POSIX_THREADS 1
| #define PTHREAD_SYSTEM_SCHED_SUPPORTED 1
| #define HAVE_PTHREAD_SIGMASK 1
| #define WITH_DOC_STRINGS 1
| #define WITH_PYMALLOC 1
| #define HAVE_DLOPEN 1
| #define HAVE_DYNAMIC_LOADING 1
| #define HAVE_ALARM 1
| #define HAVE_CHOWN 1
| #define HAVE_CLOCK 1
| #define HAVE_CONFSTR 1
| #define HAVE_CTERMID 1
| #define HAVE_EXECV 1
| #define HAVE_FORK 1
| #define HAVE_FPATHCONF 1
| #define HAVE_FTIME 1
| #define HAVE_FTRUNCATE 1
| #define HAVE_GAI_STRERROR 1
| #define HAVE_GETGROUPS 1
| #define HAVE_GETLOGIN 1
| #define HAVE_GETPEERNAME 1
| #define HAVE_GETPGID 1
| #define HAVE_GETPID 1
| #define HAVE_GETPRIORITY 1
| #define HAVE_GETPWENT 1
| #define HAVE_GETSID 1
| #define HAVE_GETWD 1
| #define HAVE_KILL 1
| #define HAVE_KILLPG 1
| #define HAVE_LCHOWN 1
| #define HAVE_LSTAT 1
| #define HAVE_MKFIFO 1
| #define HAVE_MKNOD 1
| #define HAVE_MKTIME 1
| #define HAVE_NICE 1
| #define HAVE_PATHCONF 1
| #define HAVE_PAUSE 1
| #define HAVE_PLOCK 1
| #define HAVE_POLL 1
| #define HAVE_PUTENV 1
| #define HAVE_READLINK 1
| #define HAVE_REALPATH 1
| #define HAVE_SELECT 1
| #define HAVE_SETGID 1
| #define HAVE_SETLOCALE 1
| #define HAVE_SETREGID 1
| #define HAVE_SETREUID 1
| #define HAVE_SETSID 1
| #define HAVE_SETPGID 1
| #define HAVE_SETPGRP 1
| #define HAVE_SETUID 1
| #define HAVE_SETVBUF 1
| #define HAVE_SNPRINTF 1
| #define HAVE_SIGACTION 1
| #define HAVE_SIGINTERRUPT 1
| #define HAVE_SIGRELSE 1
| #define HAVE_STRFTIME 1
| #define HAVE_SYSCONF 1
| #define HAVE_TCGETPGRP 1
| #define HAVE_TCSETPGRP 1
| #define HAVE_TEMPNAM 1
| #define HAVE_TIMES 1
| #define HAVE_TMPFILE 1
| #define HAVE_TMPNAM 1
| #define HAVE_TRUNCATE 1
| #define HAVE_UNAME 1
| #define HAVE_UTIMES 1
| #define HAVE_WAITPID 1
| #define HAVE_WCSCOLL 1
| #define HAVE_CHROOT 1
| #define HAVE_LINK 1
| #define HAVE_SYMLINK 1
| #define HAVE_FCHDIR 1
| #define HAVE_FSYNC 1
| #define HAVE_FDATASYNC 1
| #define HAVE_GETPAGESIZE 1
| #define HAVE_INET_ATON 1
| #define HAVE_INET_PTON 1
| #define HAVE_SETGROUPS 1
| #define HAVE_FSEEKO 1
| #define HAVE_FSTATVFS 1
| #define HAVE_FTELLO 1
| #define HAVE_STATVFS 1
| #define HAVE_DUP2 1
| #define HAVE_GETCWD 1
| #define HAVE_STRDUP 1
| #define HAVE_STRERROR 1
| #define HAVE_MEMMOVE 1
| #define HAVE_GETPGRP 1
| #define HAVE_SETPGRP 1
| #define HAVE_GETTIMEOFDAY 1
| /* end confdefs.h.  */
|
| #include <sys/types.h>
| #include <netdb.h>
| #include <string.h>
| #include <sys/socket.h>
| #include <netinet/in.h>
|
| main()
| {
|   int passive, gaierr, inet4 = 0, inet6 = 0;
|   struct addrinfo hints, *ai, *aitop;
|   char straddr[INET6_ADDRSTRLEN], strport[16];
|
|   for (passive = 0; passive <= 1; passive++) {
|     memset(&hints, 0, sizeof(hints));
|     hints.ai_family = AF_UNSPEC;
|     hints.ai_flags = passive ? AI_PASSIVE : 0;
|     hints.ai_socktype = SOCK_STREAM;
|     hints.ai_protocol = IPPROTO_TCP;
|     if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) !
= 0) {
|       (void)gai_strerror(gaierr);
|       goto bad;
|     }
|     for (ai = aitop; ai; ai = ai->ai_next) {
|       if (ai->ai_addr == NULL ||
|           ai->ai_addrlen == 0 ||
|           getnameinfo(ai->ai_addr, ai->ai_addrlen,
|                       straddr, sizeof(straddr), strport, sizeof
(strport),
|                       NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
|         goto bad;
|       }
|       switch (ai->ai_family) {
|       case AF_INET:
|         if (strcmp(strport, "54321") != 0) {
|           goto bad;
|         }
|         if (passive) {
|           if (strcmp(straddr, "0.0.0.0") != 0) {
|             goto bad;
|           }
|         } else {
|           if (strcmp(straddr, "127.0.0.1") != 0) {
|             goto bad;
|           }
|         }
|         inet4++;
|         break;
|       case AF_INET6:
|         if (strcmp(strport, "54321") != 0) {
|           goto bad;
|         }
|         if (passive) {
|           if (strcmp(straddr, "::") != 0) {
|             goto bad;
|           }
|         } else {
|           if (strcmp(straddr, "::1") != 0) {
|             goto bad;
|           }
|         }
|         inet6++;
|         break;
|       case AF_UNSPEC:
|         goto bad;
|         break;
|       default:
|         /* another family support? */
|         break;
|       }
|     }
|   }
|
|   if (!(inet4 == 0 || inet4 == 2))
|     goto bad;
|   if (!(inet6 == 0 || inet6 == 2))
|     goto bad;
|
|   if (aitop)
|     freeaddrinfo(aitop);
|   exit(0);
|
|  bad:
|   if (aitop)
|     freeaddrinfo(aitop);
|   exit(1);
| }
|
configure:14351: result: buggy


----------------------------------------------------------------------

Comment By: Paul D. Lusk (plusk)
Date: 2004-08-05 08:06

Message:
Logged In: YES 
user_id=1083789

I just checked, and man getaddrinfo shows that HPUX _does_
have getaddrinfo:

 getaddrinfo(3N)                                             getaddrinfo
(3N)

 NAME
      getaddrinfo(), getnameinfo(), freeaddrinfo(), gai_strerror
() - get
      hostname and address entry

 SYNOPSIS
      #include <sys/socket.h>
      #include <netdb.h>

      int getaddrinfo(const char *hostname, const char 
*servname,
                      const struct addrinfo *hints, struct addrinfo 
**res);

      int getnameinfo(const struct sockaddr *sa, size_t salen,
                      char *host, size_t hostlen,
                      char *serv, size_t servlen, int flags);

      void freeaddrinfo(struct addrinfo *ai);

      char *gai_strerror(int encode);
 
So the real problem is that configure didn't find it.

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2004-08-04 13:36

Message:
Logged In: YES 
user_id=21627

Does that mean HP-UX does not have a native getaddrinfo?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=991125&group_id=5470


More information about the Python-bugs-list mailing list