Re: Solaris getopt_long and PostgreSQL

Поиск
Список
Период
Сортировка
От Zdenek Kotala
Тема Re: Solaris getopt_long and PostgreSQL
Дата
Msg-id 49BFCC35.8030108@sun.com
обсуждение исходный текст
Ответ на Solaris getopt_long and PostgreSQL  (Chuck McDevitt <cmcdevitt@greenplum.com>)
Ответы Re: Solaris getopt_long and PostgreSQL
Список pgsql-hackers
Dne 17.03.09 16:38, Chuck McDevitt napsal(a):
> About a year ago, you talked to the PostgreSQL people about some problem 
> with Solaris getopt_long, and they changed the build to use the internal 
> getopt_long instead of the Solaris one?
> 

The problem was with getopt which is works little bit differently when - 
is specified in optstring. If you look in POSIX it does not define how 
getopt should work in this case. Solaris getopt implementation has 
extension for long args. Unfortunately PostgreSQL clashes with it, 
because it does not use getopt_long for long argument, but getopt(argc, 
argv,"xy-").

> 
> What was the problem with Solaris getopt_long?  Does the problem still 
> exist in Solaris 10?

yes and it will exist forever, because it is public API.

see  man -s3C getopt

> 
>  
> 
> My users are unhappy at the change, since normal getopt_long reorders 
> the args, and apparently the built-in one doesn’t, so “psql database –p 
> port” no longer works, since it treats –p as the user name.

I understand, I'm not happy too :(, but how Tom mentioned it has been 
never supposed to work. See documentation

> I don’t know if I should revert that change, or port netBSD getopt_long 
> and replace the PostgreSQL one with that.

getopt_long is OK. Problem is getopt. getopt in core is currently taken 
from *BSD but it could be updated.

One possible solution should be to use internal getopt only for postgres 
binary and for other to use solaris libc version.
Zdenek



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Ignore -- testing message-id on footer
Следующее
От: Zdenek Kotala
Дата:
Сообщение: Re: Solaris getopt_long and PostgreSQL