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 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: >> \PostgreSQL\mast

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 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

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 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 WIN32 code > that uses

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 b

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 spa

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

2014-04-30 Thread Tom Lane
Heikki Linnakangas 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 out-of-memory (possibly

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 t

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 cur

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 wrote: Heikki Linnakangas 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-Window

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

2014-04-29 Thread Tom Lane
Amit Kapila writes: > On Wed, Apr 30, 2014 at 3:57 AM, Tom Lane 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 using a #define to redefine popen().

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 wrote: > Heikki Linnakangas 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 >

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

2014-04-29 Thread Tom Lane
Heikki Linnakangas 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()

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 bat

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

2014-04-29 Thread Nikhil Deshpande
Hi, 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 file. Here's a patch that fixes initdb by