pgsql: Fix assorted issues in pg_ctl's pgwin32_CommandLine().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix assorted issues in pg_ctl's pgwin32_CommandLine().
Date: 2013-11-29 23:34:59
Message-ID: E1VmXaN-0006np-OF@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix assorted issues in pg_ctl's pgwin32_CommandLine().

Ensure that the invocation command for postgres or pg_ctl runservice
double-quotes the executable's pathname; failure to do this leads to
trouble when the path contains spaces.

Also, ensure that the path ends in ".exe" in both cases and uses
backslashes rather than slashes as directory separators. The latter issue
is reported to confuse some third-party tools such as Symantec Backup Exec.

Also, rewrite the function to avoid buffer overrun issues by using a
PQExpBuffer instead of a fixed-size static buffer. Combinations of
very long executable pathnames and very long data directory pathnames
could have caused trouble before, for example.

Back-patch to all active branches, since this code has been like this
for a long while.

Naoya Anzai and Tom Lane, reviewed by Rajeev Rastogi

Branch
------
REL8_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/6cb109a81289aec8c9078cc96fb721ff9e91d14d

Modified Files
--------------
src/bin/pg_ctl/pg_ctl.c | 76 +++++++++++++++++++++++++----------------------
1 file changed, 41 insertions(+), 35 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alvaro Herrera 2013-11-30 01:06:08 pgsql: Fix full-table-vacuum request mechanism for MultiXactIds
Previous Message Tom Lane 2013-11-29 22:35:30 pgsql: Be sure to release proc->backendLock after SetupLockInTable() fa