On 04/30/2014 07:39 AM, Amit Kapila wrote:
On Wed, Apr 30, 2014 at 3:57 AM, Tom Lane <t...@sss.pgh.pa.us> wrote:
Heikki Linnakangas <hlinnakan...@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


--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to