Skip site navigation (1) Skip section navigation (2)

Re: Solaris getopt_long and PostgreSQL

From: Zdenek Kotala <Zdenek(dot)Kotala(at)Sun(dot)COM>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Chuck McDevitt <cmcdevitt(at)greenplum(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Solaris getopt_long and PostgreSQL
Date: 2009-03-30 20:10:01
Message-ID: 1238443801.1329.94.camel@localhost (view raw or flat)
Thread:
Lists: pgsql-hackers
Tom Lane píše v so 28. 03. 2009 v 14:36 -0400:

> Apparently the system version of getopt_long is broken on Solaris 11.
> My patience for this grows short.

It is not problem with getopt_long itself, but with symbol overriding.
getopt_long uses optind and so on from libc, but e.g. initdb takes
optind which is defined in port/getopt.c. It causes problem in following
code:

02607     /* Non-option argument specifies data directory */
02608     if (optind < argc)

which compares different variable.

I think it is general problem. HAVE_GETOPT_LONG cannot be defined when
HAVE_GETOPT_H is not defined.

I'm sorry for my previous patch. I had to make some mistake in
autoconf/make magic.

I attached a fix. Only problem what I see there is getopt_long.h which
contains 

#ifdef HAVE_GETOPT_H
#include <getopt.h>
#endif

but getopt.h is required for getopt_long(). Fortunately, content is
similar with getopt_long.h and there is no problem with it on Solaris.

		Zdenek




Attachment: getopt.patch
Description: text/x-patch (1.2 KB)

In response to

Responses

pgsql-hackers by date

Next:From: Zdenek KotalaDate: 2009-03-30 20:26:22
Subject: Re: More message encoding woes
Previous:From: Dimitri FontaineDate: 2009-03-30 19:59:41
Subject: Re: psql \d* and system objects

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group