pgsql: Make initdb's suggested "pg_ctl start" command line more reliabl

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Make initdb's suggested "pg_ctl start" command line more reliabl
Date: 2016-08-20 19:05:30
Message-ID: E1bbBaE-0001j6-Gz@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Make initdb's suggested "pg_ctl start" command line more reliable.

The original coding here was not nearly careful enough about quoting
special characters, and it didn't get corner cases right for constructing
the pg_ctl path either. Use join_path_components() and appendShellString()
to do it honestly, so that the string will more likely work if blindly
copied-and-pasted.

While at it, teach appendShellString() not to quote strings that clearly
don't need it, so that the output from initdb doesn't become uglier than
it was before in typical cases where quoting is not needed.

Ryan Murphy, reviewed by Michael Paquier and myself

Discussion: <CAHeEsBeAe1FeBypT3E8R1ZVZU0e8xv3A-7BHg6bEOi=jZny2Uw(at)mail(dot)gmail(dot)com>

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/a00c58314745772f6c6a49b6d02a9572cd600bda

Modified Files
--------------
src/bin/initdb/Makefile | 3 +++
src/bin/initdb/initdb.c | 43 ++++++++++++++++++++++++++++---------------
src/fe_utils/string_utils.c | 17 +++++++++++++++--
3 files changed, 46 insertions(+), 17 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2016-08-20 20:53:29 pgsql: initdb now needs to reference libpq include files in MSVC builds
Previous Message Tom Lane 2016-08-19 21:33:04 pgsql: Allow empty queries in pgbench.

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2016-08-20 19:29:10 Re: PROPOSAL: make PostgreSQL sanitizers-friendly (and prevent information disclosure)
Previous Message Tom Lane 2016-08-20 18:38:52 Re: Should we cacheline align PGXACT?