Re: Fix initdb for path with whitespace and at char
От | Heikki Linnakangas |
---|---|
Тема | Re: Fix initdb for path with whitespace and at char |
Дата | |
Msg-id | 535FFBC1.2020402@vmware.com обсуждение исходный текст |
Ответ на | Fix initdb for path with whitespace and at char (Nikhil Deshpande <nikhail@gmail.com>) |
Ответы |
Re: Fix initdb for path with whitespace and at char
|
Список | pgsql-hackers |
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 file. > > Here's a patch that fixes initdb by enclosing the command string in > extra double quotes being passed to popen() (similar to system() call). 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() call in COPY TO/FROM PROGRAM command. Is there any situation where would *not* want to wrap the command in SYSTEMQUOTEs? If there isn't, ISTM it would be better to create a wrapper function, pgwin32_popen(), which adds the quotes instead of sprinkling them into all callers. Even if we go around and fix all of the callers now, we're bound to forget it again in the future. - Heikki
В списке pgsql-hackers по дате отправления: