Re: AIX 4.3 getaddrinfo busted

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: AIX 4.3 getaddrinfo busted
Дата
Msg-id 200901231441.n0NEfuA22244@momjian.us
обсуждение исходный текст
Ответ на Re: AIX 4.3 getaddrinfo busted  (Andrew Chernow <ac@esilo.com>)
Ответы Re: AIX 4.3 getaddrinfo busted  (Andrew Chernow <ac@esilo.com>)
Список pgsql-hackers
Andrew Chernow wrote:
> Bruce Momjian wrote:
> > Andrew Chernow wrote:
> >> AIX 4.3 was released in late 1999, so I thought it was worth mentioning. 
> >>   I only have AIX 4.3 and 6.1, so I have no idea how AIX 5 handles this. 
> >>   AIX 6.1 works fine.
> >>
> >> Anyways, the service argument to getaddrinfo is busted on AIX 4.3, thus 
> >>   src/backend/libpq/ip.c pg_getaddrinfo_all() is busted on this 
> >> platform.  It fails with EAI_NODATA "Host not found".   If this argument 
> >> is left NULL, everything works.
> >>
> >> I can supply a patch to fix this.  My suggestion would be to always 
> >> supply a NULL service to getaddrinfo.  After a successful call, set the 
> >> port if it was provided ... htons((unsigned short)atoi(servname)).  This 
> >> approach avoids a configure check.
> > 
> > Why would we risk breaking other platforms to avoid an AIX bug?  At best
> > we can put a code comment in that section of the code.
> > 
> 
> IMO, there is no risk.  getaddrinfo allows a NULL second argument on 
> every platform I have worked with.  I can't see this breaking anything. 
>   Our internal libraries do it this way for this exact reason, and it 
> works on a large number of platforms.
> 
> But, it can be done so that it only affects AIX machines.  There is 
> already a #ifdef _AIX block in this function so we can handle all AIX 
> versions as I have suggested and let everyone else run the same old code.
> 
> #ifdef _AIX
> getaddrinfo(hostname, NULL /* servname */, ....);
> // manually set the port
> #else
> getaddrinfo(hostname, servname, ....); /* same code as now */
> #endif

Well, the platform is from 1999 and we have never had bug reports on
this, even though the code has been there for quite a few years;  I just
don't see the motivation for the change.

If you really want this platform to work, I would submit a patch that
tests for a C compiler symbol or #define that is only defined for that
platform and make service = null in that case.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Simon Riggs
Дата:
Сообщение: Re: Hot Standby (v9d)
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: AIX 4.3 getaddrinfo busted