Re: Fix initdb for path with whitespace and at char - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Fix initdb for path with whitespace and at char
Date
Msg-id 5360AF69.9080802@vmware.com
Whole thread Raw
In response to Re: Fix initdb for path with whitespace and at char  (Amit Kapila <amit.kapila16@gmail.com>)
Responses Re: Fix initdb for path with whitespace and at char  (Heikki Linnakangas <hlinnakangas@vmware.com>)
List pgsql-hackers
On 04/30/2014 07:39 AM, Amit Kapila wrote:
> On Wed, Apr 30, 2014 at 3:57 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Heikki Linnakangas <hlinnakangas@vmware.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



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: GSoC on WAL-logging hash indexes
Next
From: Etsuro Fujita
Date:
Subject: Re: Minor improvement to fdwhandler.sgml