Re: Fix initdb for path with whitespace and at char

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Nikhil Deshpande <nikhail(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix initdb for path with whitespace and at char
Date: 2014-04-30 08:08:09
Message-ID: 5360AF69.9080802@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 04/30/2014 07:39 AM, Amit Kapila wrote:
> On Wed, Apr 30, 2014 at 3:57 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>> Heikki Linnakangas <hlinnakangas(at)vmware(dot)com> writes:
>>> This looks correct to me. popen() requires SYSTEMQUOTEs on Windows, like
>>> system() does.
>
> It seems right now SYSTEMQUOTE is used before popen both for
> Windows and non-Windows, ex. adjust_data_dir() in pg_ctl.c

Yeah, but it's defined to an empty string on non-Windows platforms.

>> 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().

Right, that's exactly what I meant by a wrapper function.

> Won't defining variant of popen just for Windows to add SYSTEMQUOTE
> effect such (where currently it is used for both win and non-winows)
> usage? Also, I think we might want to remove use of SYSTEMQUOTE
> before popen calls where ever it is currently used to avoid usage of the
> same two times.

Yep.

I'll write up a patch to do that for git master. For back-branches, I
just added the missing SYSTEMQUOTEs. There are a couple of places where
changing the behavior might break existing installations. In particular,
in the stable branches it's probably best to not add the SYSTEMQUOTEs to
things like archive_command, restore_command, and COPY TO/FROM PROGRAM,
where the command is specified by the user. Because people might already
have added the extra quotes to the command to make it work, and if we
suddenly start adding yet another pair of quotes, it will stop working.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2014-04-30 08:10:50 Re: Minor improvement to fdwhandler.sgml
Previous Message Peter Geoghegan 2014-04-30 07:26:20 Re: GSoC on WAL-logging hash indexes