Re: Re: [COMMITTERS] pgsql: Make initdb's suggested "pg_ctl start" command line more reliabl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Claudio Freire <klaussfreire(at)gmail(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Re: [COMMITTERS] pgsql: Make initdb's suggested "pg_ctl start" command line more reliabl
Date: 2016-09-06 17:41:26
Message-ID: 6078.1473183686@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Claudio Freire <klaussfreire(at)gmail(dot)com> writes:
> On Tue, Sep 6, 2016 at 2:08 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Dash is considered a character that needs quoting. It might be possible
>> to avoid that if we could be certain that appendShellString's output would
>> never be placed in a spot where it could be taken for a switch, but that
>> seems like a large assumption to me.

> Wouldn't it be taken for a switch even with quoting?
> Quoting "-D" seems to work fine, which would suggest the above is true.

[ thinks about that... ] Oh, you're right, brain fade on my part. The
shell doesn't care whether words are switches or not. So actually the
risk-factor for us is whether we have designed any command-line syntaxes
in a way that would allow a path starting with a dash to cause bad things
to happen. I have a feeling the answer is "yes", even without considering
the prospect that GNU getopt will arbitrarily rearrange the command words
on us depending on what it thinks is a switch. (Maybe leading-dash is
another one of the things we'd better make a policy against.)

But meanwhile, yes, the argument for treating it as quotable in
appendShellString seems completely bogus. I'll go change that.

regards, tom lane

In response to

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-09-06 18:53:41 pgsql: Teach appendShellString() to not quote strings containing "-".
Previous Message Tom Lane 2016-09-06 17:26:50 pgsql: Repair whitespace in initdb message.

Browse pgsql-hackers by date

  From Date Subject
Next Message Petr Jelinek 2016-09-06 17:42:01 Re: Logical Replication WIP
Previous Message Doug Doole 2016-09-06 17:40:02 Re: ICU integration