Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhKOg-0001N7-Bh for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 17:42:58 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bhKOf-0000JT-PD for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Sep 2016 17:42:57 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bhKNH-0004nj-EY for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 17:41:31 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bhKNF-0007tI-1e for pgsql-hackers@postgresql.org; Tue, 06 Sep 2016 17:41:30 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u86HfQtS006079; Tue, 6 Sep 2016 13:41:26 -0400 From: Tom Lane To: Claudio Freire cc: Peter Eisentraut , pgsql-hackers Subject: Re: Re: [COMMITTERS] pgsql: Make initdb's suggested "pg_ctl start" command line more reliabl In-reply-to: References: <26516.1473181731@sss.pgh.pa.us> Comments: In-reply-to Claudio Freire message dated "Tue, 06 Sep 2016 14:20:08 -0300" Date: Tue, 06 Sep 2016 13:41:26 -0400 Message-ID: <6078.1473183686@sss.pgh.pa.us> X-Pg-Spam-Score: -3.0 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Claudio Freire writes: > On Tue, Sep 6, 2016 at 2:08 PM, Tom Lane 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 -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers