Re: windows / initdb oddness - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: windows / initdb oddness
Date
Msg-id 43FC5B3B.4080307@dunslane.net
Whole thread Raw
In response to Re: windows / initdb oddness  ("Magnus Hagander" <mha@sollentuna.net>)
Responses Re: windows / initdb oddness
List pgsql-hackers

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


pgsql-hackers by date:

Previous
From: Andreas Pflug
Date:
Subject: Re: pg_config, pg_service.conf, postgresql.conf ....
Next
From: Andrew Dunstan
Date:
Subject: Re: PostgreSQL unit tests