Re: Fix initdb for path with whitespace and at char

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
Cc: Nikhil Deshpande <nikhail(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Fix initdb for path with whitespace and at char
Date: 2014-04-29 22:27:53
Message-ID: 29066.1398810473@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
> This looks correct to me. popen() requires SYSTEMQUOTEs on Windows, like
> system() does. We already use SYSTEMQUOTEs in some popen() calls, like
> in pg_ctl, but initdb is missing them. get_bin_version function in
> pg_upgrade is also missing it, as is the popen() call in COPY TO/FROM
> PROGRAM command.

Yuck.

> Is there any situation where would *not* want to wrap the command in
> SYSTEMQUOTEs? If there isn't, ISTM it would be better to create a
> wrapper function, pgwin32_popen(), which adds the quotes instead of
> sprinkling them into all callers. Even if we go around and fix all of
> the callers now, we're bound to forget it again in the future.

We might forget to use the wrapper function too, if it has a nonstandard
name, no? A better idea would be to redefine popen() and system() on
Windows. It looks like we're already using a #define to redefine popen().
This approach would let us get rid of nonstandard notation for this
problem, instead of adding more.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2014-04-29 23:44:33 Re: pg_dump --pretty-print-views
Previous Message Stephen Frost 2014-04-29 22:27:50 Re: Considerer Harmful Considered Harmful