Re: Fix initdb for path with whitespace and at char

Поиск
Список
Период
Сортировка
От Heikki Linnakangas
Тема Re: Fix initdb for path with whitespace and at char
Дата
Msg-id 5360D119.4070708@vmware.com
обсуждение исходный текст
Ответ на Re: Fix initdb for path with whitespace and at char  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Ответы Re: Fix initdb for path with whitespace and at char  (Andrew Dunstan <andrew@dunslane.net>)
Re: Fix initdb for path with whitespace and at char  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Fix initdb for path with whitespace and at char  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
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
currently (ie. before this patch) wrong for cygwin builds. SYSTEMQUOTE
is defined as:

#if defined(WIN32) && !defined(__CYGWIN__)
#define SYSTEMQUOTE "\""
#else
#define SYSTEMQUOTE ""
#endif

I presume the !CYGWIN part is because cygwin version of system() and
popen() don't require the extra quoting, because cygwin does that for
us. But when we use CreateProcess directly, e.g like this in pg_ctl.c:

   snprintf(cmd, MAXPGPATH, "CMD /C " SYSTEMQUOTE "\"\"%s\" %s%s <
\"%s\" 2>&1\"" SYSTEMQUOTE,
            exec_path, pgdata_opt, post_opts, DEVNULL);

   if (!CreateRestrictedProcess(cmd, &pi, false))
     return GetLastError();

we would need the extra quotes, but SYSTEMQUOTE doesn't provide them
with cygwin.


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 attached patch
fixes it.

- Heikki

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Etsuro Fujita
Дата:
Сообщение: Re: Minor improvement to fdwhandler.sgml
Следующее
От: Heikki Linnakangas
Дата:
Сообщение: Re: includedir_internal headers are not self-contained