Re: [HACKERS] Potential issue with alter system - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Potential issue with alter system
Date
Msg-id 26400.1493927369@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] Potential issue with alter system  ("Joshua D. Drake" <jd@commandprompt.com>)
Responses Re: [HACKERS] Potential issue with alter system  ("Joshua D. Drake" <jd@commandprompt.com>)
List pgsql-hackers
"Joshua D. Drake" <jd@commandprompt.com> writes:
> So I did this:

> postgres=# alter system set archive_command to 'rsynv -av %p
> postgres@52.3.141.224:/data/archive/%f
> ';

> Note the new line. It properly created in postgresql.auto.conf:

> archive_command = 'rsynv -av %p postgres@52.3.141.224:/data/archive/%f
> '
> (note the new line)

Ugh.  That's broken --- we don't support newlines within values in
postgresql.conf files.

[ pokes around ... ]  HEAD seems to reject this properly:

regression=# alter system set archive_command to 'rsynv -av %p postgres@52.3.141.224:/data/archive/%f
regression'# ';
ERROR:  parameter value for ALTER SYSTEM must not contain a newline

> This is 9.5.2 (Yes, I know... I am in the process of setting up
> replication to 9.5.6 for failover).

Ah.  [ digs further... ]  Yup, we fixed that in 9.5.3:

Author: Tom Lane <tgl@sss.pgh.pa.us>
Branch: master Release: REL9_6_BR [99f3b5613] 2016-04-04 18:05:23 -0400
Branch: REL9_5_STABLE Release: REL9_5_3 [f3d17491c] 2016-04-04 18:05:23 -0400
Branch: REL9_4_STABLE Release: REL9_4_8 [28148e258] 2016-04-04 18:05:24 -0400
   Disallow newlines in parameter values to be set in ALTER SYSTEM.      As noted by Julian Schauder in bug #14063, the
configuration-fileparser   doesn't support embedded newlines in string literals.  While there might   someday be a good
reasonto remove that restriction, there doesn't seem   to be one right now.  However, ALTER SYSTEM SET could accept
strings  containing newlines, since many of the variable-specific value-checking   routines would just see a newline as
whitespace. This led to writing a   postgresql.auto.conf file that was broken and had to be removed manually.
Pendinga reason to work harder, just throw an error if someone tries this.      In passing, fix several places in the
ALTERSYSTEM logic that failed to   provide an errcode() for an ereport(), and thus would falsely log the   failure as
aninternal XX000 error.      Back-patch to 9.4 where ALTER SYSTEM was introduced. 


If you have other entries you want to keep in the postgresql.auto.conf
file, you could get away with manually editing it to remove the newline.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Fix freeing of dangling IndexScanDesc.xs_hitup in GiST
Next
From: Nikita Glukhov
Date:
Subject: Re: [HACKERS] Fix freeing of dangling IndexScanDesc.xs_hitup in GiST