Re: windows / initdb oddness

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Magnus Hagander <mha(at)sollentuna(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: windows / initdb oddness
Date: 2006-02-22 12:38:19
Message-ID: 43FC5B3B.4080307@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Magnus Hagander wrote:

>>>
>>>The solution would be put --restrictedexec earlier on the
>>>
>>>
>>new command
>>
>>
>>>line. I'll work on that.
>>>
>>>
>>The probem is apparently the one I identified above, and is
>>fixed by the attached patch, which I will apply soon unless
>>there are objections.
>>
>>As for why we saw this on loris but not snake, I suspect they
>>might have different getopt libraries installed.
>>
>>
>
>Isn't that just fixing the symptom and not the actual bug? In this case,
>if we cause the bug, we should do this as well, but doesn't it crash the
>same way if you *manually* put arguments in the "wrong order" on the
>commandline? Like "inidb foo --no-locale" or somehting like that?
>
>(I still can't reproduce it on my machines, so I guess I have a better
>getopt as well.)
>
>
>
>

We don't promise that you can put the pgdata argument anywhere except at
the end of the command line. In fact, our manual page requires it at the
end. Even on systems with GNU getopt, if POSIXLY_CORRECT is set then
processing would stop at the first non-getopt argument.

So I can live with bombing, even if it's a bit unpleasant, in the case
of "initdb foo --no-locale", but we cannot *cause* that by appending a
secret argument ourselves, so that "initdb foo" also bombs.

The logic to detect and correct this in the general case before getopt
is called is not worth the pain.

cheers

andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Dunstan 2006-02-22 12:44:54 Re: PostgreSQL unit tests
Previous Message Andreas Pflug 2006-02-22 11:09:39 Re: pg_config, pg_service.conf, postgresql.conf ....

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2006-02-22 16:12:22 Re: windows / initdb oddness
Previous Message David Fetter 2006-02-22 07:31:14 Re: Uninstall scripts for contrib