Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-05-05 Thread Heikki Linnakangas
On 05/01/2014 07:55 AM, Amit Kapila wrote: On Wed, Apr 30, 2014 at 4:01 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: I committed the non-invasive fixes to backbranches (and master too, just to keep it in sync), but the attached is what I came up with for master. There are a couple of

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-05-05 Thread Amit Kapila
On Mon, May 5, 2014 at 6:38 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: On 05/01/2014 07:55 AM, Amit Kapila wrote: 4. Similar to Andrew, I also could not reproduce this problem on my Windows system (Windows 7 64 bit) e:\e:\PostgreSQL\master\install 1\ins@1\bin\initdb.exe -D e:

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-30 Thread Heikki Linnakangas
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

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-30 Thread Heikki Linnakangas
I committed the non-invasive fixes to backbranches (and master too, just to keep it in sync), but the attached is what I came up with for master. There are a couple of places in the code where we have #ifdef WIN32 code that uses CreateProcess with CMD /C ... directly. I believe those are

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-30 Thread Andrew Dunstan
On 04/30/2014 06:31 AM, Heikki Linnakangas wrote: Andrew: you have a cygwin installation, don't you? Could you test if pg_ctl start works when the binaries are installed to a path that contains both a space and an @ sign, like C:\white space\at@sign\install. I suspect it doesn't, but the

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-30 Thread Tom Lane
Heikki Linnakangas hlinnakan...@vmware.com writes: I committed the non-invasive fixes to backbranches (and master too, just to keep it in sync), but the attached is what I came up with for master. The malloc's in the new system.c file should be pg_malloc, or else have custom defenses against

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-30 Thread Andrew Dunstan
On 04/30/2014 11:58 AM, Andrew Dunstan wrote: On 04/30/2014 06:31 AM, Heikki Linnakangas wrote: Andrew: you have a cygwin installation, don't you? Could you test if pg_ctl start works when the binaries are installed to a path that contains both a space and an @ sign, like C:\white

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-30 Thread Andrew Dunstan
On 04/30/2014 03:03 PM, Andrew Dunstan wrote: On 04/30/2014 11:58 AM, Andrew Dunstan wrote: On 04/30/2014 06:31 AM, Heikki Linnakangas wrote: Andrew: you have a cygwin installation, don't you? Could you test if pg_ctl start works when the binaries are installed to a path that contains

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-30 Thread Amit Kapila
On Wed, Apr 30, 2014 at 4:01 PM, Heikki Linnakangas hlinnakan...@vmware.com wrote: I committed the non-invasive fixes to backbranches (and master too, just to keep it in sync), but the attached is what I came up with for master. There are a couple of places in the code where we have #ifdef

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-29 Thread Heikki Linnakangas
On 04/29/2014 09:14 PM, Nikhil Deshpande wrote: On win32, initdb fails if it's path includes a space and at ('@') character. E.g. C:\C:\Program Files\user@company\Postgres\9.3\bin\initdb.exe -D c:\baz 'C:\Program' is not recognized as an internal or external command, operable program or batch

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-29 Thread Tom Lane
Heikki Linnakangas hlinnakan...@vmware.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

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-29 Thread Amit Kapila
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,

Re: [HACKERS] Fix initdb for path with whitespace and at char

2014-04-29 Thread Tom Lane
Amit Kapila amit.kapil...@gmail.com writes: On Wed, Apr 30, 2014 at 3:57 AM, Tom Lane t...@sss.pgh.pa.us wrote: 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