Re: fixing pg_ctl with relative paths

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Hari Babu <haribabu(dot)kommi(at)huawei(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: fixing pg_ctl with relative paths
Date: 2013-07-02 00:10:14
Message-ID: CAK3UJRE0tQMv_NfwzW39rCD_x7-NAv=W4pLP6cJy8yVo2jbJcw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 27, 2013 at 11:47 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
> On Thu, Jun 27, 2013 at 10:36 AM, Josh Kupershmidt <schmiddy(at)gmail(dot)com> wrote:
>> On Wed, Jun 26, 2013 at 12:22 PM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com> wrote:
>>> Though this is a corner case, the patch doesn't seem to handle properly the case
>>> where "-D" appears as other option value, e.g., -k option value, in
>>> postmaster.opts
>>> file.
>>
>> Could I see a command-line example of what you mean?
>
> postmaster -k "-D", for example. Of course, it's really a corner case :)

Oh, I see. I was able to trip up strip_datadirs() with something like

$ PGDATA="/my/data/" postmaster -k "-D" -S 100 &
$ pg_ctl -D /my/data/ restart

that example causes pg_ctl to fail to start the server after stopping
it, although perhaps you could even trick the server into starting
with the wrong options. Of course, similar problems exists today in
other cases, such as with the relative paths issue this patch is
trying to address, or a datadir containing embedded quotes.

I am eager to see the relative paths issue fixed, but maybe we need to
bite the bullet and sort out the escaping of command-line options in
the rest of pg_ctl first, so that a DataDir like "/tmp/here's a \"
quote" can consistently be used by pg_ctl {start|stop|restart} before
we can fix this wart.

Josh

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2013-07-02 00:23:26 Re: Eliminating PD_ALL_VISIBLE, take 2
Previous Message Andreas Karlsson 2013-07-02 00:04:55 Re: PL/Lua (was: plpython implementation)