pgsql: Replace SYSTEMQUOTEs with Windows-specific wrapper functions. - Mailing list pgsql-committers

From Heikki Linnakangas
Subject pgsql: Replace SYSTEMQUOTEs with Windows-specific wrapper functions.
Date
Msg-id E1WhIdE-0007vV-Cp@gemulon.postgresql.org
Whole thread Raw
Responses Re: pgsql: Replace SYSTEMQUOTEs with Windows-specific wrapper functions.
Re: pgsql: Replace SYSTEMQUOTEs with Windows-specific wrapper functions.
List pgsql-committers
Replace SYSTEMQUOTEs with Windows-specific wrapper functions.

It's easy to forget using SYSTEMQUOTEs when constructing command strings
for system() or popen(). Even if we fix all the places missing it now, it is
bound to be forgotten again in the future. Introduce wrapper functions that
do the the extra quoting for you, and get rid of SYSTEMQUOTEs in all the
callers.

We previosly used SYSTEMQUOTEs in all the hard-coded command strings, and
this doesn't change the behavior of those. But user-supplied commands, like
archive_command, restore_command, COPY TO/FROM PROGRAM calls, as well as
pgbench's \shell, will now gain an extra pair of quotes. That is desirable,
but if you have existing scripts or config files that include an extra
pair of quotes, those might need to be adjusted.

Reviewed by Amit Kapila and Tom Lane

Branch
------
master

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

Modified Files
--------------
configure.in                               |    1 +
contrib/pg_upgrade/check.c                 |    2 +-
contrib/pg_upgrade/controldata.c           |    2 +-
contrib/pg_upgrade/exec.c                  |    4 +-
src/bin/initdb/initdb.c                    |   40 +++++-----
src/bin/pg_ctl/pg_ctl.c                    |   14 ++--
src/bin/pg_dump/pg_dumpall.c               |    4 +-
src/bin/psql/command.c                     |    6 +-
src/include/port.h                         |   45 +++--------
src/interfaces/ecpg/test/pg_regress_ecpg.c |    2 +-
src/interfaces/libpq/Makefile              |    6 +-
src/interfaces/libpq/bcc32.mak             |    7 ++
src/interfaces/libpq/win32.mak             |    7 ++
src/port/system.c                          |  117 ++++++++++++++++++++++++++++
src/test/isolation/isolation_main.c        |    2 +-
src/test/regress/pg_regress.c              |   26 +++----
src/test/regress/pg_regress_main.c         |    2 +-
src/tools/msvc/Mkvcbuild.pm                |    2 +-
18 files changed, 196 insertions(+), 93 deletions(-)


pgsql-committers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: pgsql: Add missing 9.4 release file.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Use Size instead of uint32 to store result of sizeof()