pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
12+ messages / 4 participants
[nested] [flat]
Commits from this thread:
2021-01-08 29556bf1be 9ffe227837 c67fea09da 5ba046948e Adjust createdb TAP tests to work on recent OpenBSD.
2020-02-27 c4b0edb07e aeb846edbf 8e076f4f9a Remove TAP test for createdb --lc-ctype
* pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
@ 2020-02-27 02:23 Michael Paquier <michael@paquier.xyz>
2020-02-27 04:13 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Robert Haas <robertmhaas@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 02:23 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
The original coding failed to properly quote those arguments, leading to
failures when using quotes in the values used. As the quoting can be
encoding-sensitive, the connection to the backend needs to be taken
before applying the correct quoting.
Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200214041004.GB1998@paquier.xyz
Backpatch-through: 9.5
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/008cf040962c98c7c55d54c28dcb43c3c1d83c92
Modified Files
--------------
src/bin/scripts/createdb.c | 29 +++++++++++++++++++----------
src/bin/scripts/t/020_createdb.pl | 26 +++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 11 deletions(-)
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
@ 2020-02-27 04:13 ` Robert Haas <robertmhaas@gmail.com>
2020-02-27 05:11 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 12+ messages in thread
From: Robert Haas @ 2020-02-27 04:13 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Buildfarm member curculio just failed with this complaint:
# Failed test 'createdb with incorrect --lc-ctype stderr
/(?^s:^createdb: error: database creation failed: ERROR: invalid
locale name)/'
# at t/020_createdb.pl line 43.
# 'createdb: error: database creation failed: ERROR:
new LC_CTYPE (foo'; SELECT '1) is incompatible with the LC_CTYPE of
the template database (C)
# HINT: Use the same LC_CTYPE as in the template database, or use
template0 as template.
# '
# doesn't match '(?^s:^createdb: error: database creation failed:
ERROR: invalid locale name)'
# Looks like you failed 1 test of 22.
[04:39:08] t/020_createdb.pl .........
Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/22 subtests
...Robert
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 04:13 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Robert Haas <robertmhaas@gmail.com>
@ 2020-02-27 05:11 ` Michael Paquier <michael@paquier.xyz>
2020-02-27 13:01 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 14:25 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Alvaro Herrera <alvherre@2ndquadrant.com>
0 siblings, 2 replies; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 05:11 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
On Thu, Feb 27, 2020 at 09:43:14AM +0530, Robert Haas wrote:
> Buildfarm member curculio just failed with this complaint:
Thanks, I missed this report.
> # Failed test 'createdb with incorrect --lc-ctype stderr
> /(?^s:^createdb: error: database creation failed: ERROR: invalid
> locale name)/'
> # at t/020_createdb.pl line 43.
> # 'createdb: error: database creation failed: ERROR:
> new LC_CTYPE (foo'; SELECT '1) is incompatible with the LC_CTYPE of
> the template database (C)
> # HINT: Use the same LC_CTYPE as in the template database, or use
> template0 as template.
Now that's interesting. The error I would have expected to find is
from createdb() so as we should actually bump on a failure for
setlocale(LC_CTYPE). But this means that setlocale() with an
incorrect value actually succeeded, and that the fallback became "C".
Oh, actually, this behavior is mentioned here:
https://man.openbsd.org/setlocale.3
The best thing I can think of is just to remove the test case for
--lc-ctype. Now looking at the code of OpenBSD there could be an
alternative: using a string longer than 256 characters if I read
lib/libc/locale/setlocale.c correctly, but I'd rather not rely on
that.
Thoughts?
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 04:13 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Robert Haas <robertmhaas@gmail.com>
2020-02-27 05:11 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
@ 2020-02-27 13:01 ` Michael Paquier <michael@paquier.xyz>
2021-01-07 22:25 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Tom Lane <tgl@sss.pgh.pa.us>
1 sibling, 1 reply; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 13:01 UTC (permalink / raw)
To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
On Thu, Feb 27, 2020 at 02:11:12PM +0900, Michael Paquier wrote:
> The best thing I can think of is just to remove the test case for
> --lc-ctype.
So, thinking about nothing better, I have just removed this test.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 04:13 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Robert Haas <robertmhaas@gmail.com>
2020-02-27 05:11 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 13:01 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
@ 2021-01-07 22:25 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-01-08 01:48 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 12+ messages in thread
From: Tom Lane @ 2021-01-07 22:25 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Robert Haas <robertmhaas@gmail.com>; pgsql-committers <pgsql-committers@lists.postgresql.org>
Michael Paquier <michael@paquier.xyz> writes:
> On Thu, Feb 27, 2020 at 02:11:12PM +0900, Michael Paquier wrote:
>> The best thing I can think of is just to remove the test case for
>> --lc-ctype.
> So, thinking about nothing better, I have just removed this test.
I just tried to run check-world on an OpenBSD 6.8 installation,
and look what I got:
t/020_createdb.pl ......... 14/19
# Failed test 'createdb with incorrect --lc-collate stderr /(?^s:^createdb: error: database creation failed: ERROR: invalid locale name)/'
# at t/020_createdb.pl line 35.
# 'createdb: error: database creation failed: ERROR: new collation (foo'; SELECT '1) is incompatible with the collation of the template database (C)
# HINT: Use the same collation as in the template database, or use template0 as template.
# '
# doesn't match '(?^s:^createdb: error: database creation failed: ERROR: invalid locale name)'
# Looks like you failed 1 test of 19.
t/020_createdb.pl ......... Dubious, test returned 1 (wstat 256, 0x100)
Failed 1/19 subtests
So on this machine, setlocale() is lax about LC_COLLATE values as
well as (presumably) LC_CTYPE. Question then becomes why we did
not notice for nearly a year. It looks like, of the not-very-many
OpenBSD machines in the buildfarm, the only one running the TAP
tests is curculio, and that's running OpenBSD 5.9 which is quite old.
Comparing their setlocale(3) man pages for different versions, it
looks like the current verbiage appeared in 6.3; older versions
have text similar to other BSDen. So it looks like they actually
ripped out a lot of locale functionality in 6.3.
It seems like (1) we need to drop the --lc-collate version of this
test too, or else adjust both tests to accept the error we get on
OpenBSD as well as the normal error; (2) somebody really ought to
crank up a modern OpenBSD critter that's running the TAP tests.
regards, tom lane
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 04:13 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Robert Haas <robertmhaas@gmail.com>
2020-02-27 05:11 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 13:01 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2021-01-07 22:25 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Tom Lane <tgl@sss.pgh.pa.us>
@ 2021-01-08 01:48 ` Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 12+ messages in thread
From: Michael Paquier @ 2021-01-08 01:48 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: Robert Haas <robertmhaas@gmail.com>; pgsql-committers <pgsql-committers@lists.postgresql.org>
On Thu, Jan 07, 2021 at 05:25:24PM -0500, Tom Lane wrote:
> So on this machine, setlocale() is lax about LC_COLLATE values as
> well as (presumably) LC_CTYPE. Question then becomes why we did
> not notice for nearly a year. It looks like, of the not-very-many
> OpenBSD machines in the buildfarm, the only one running the TAP
> tests is curculio, and that's running OpenBSD 5.9 which is quite old.
> Comparing their setlocale(3) man pages for different versions, it
> looks like the current verbiage appeared in 6.3; older versions
> have text similar to other BSDen. So it looks like they actually
> ripped out a lot of locale functionality in 6.3.
Indeed. 6.3 is the point where they began ignoring LC_COLLATE, and
the buildfarm has no coverage for it. Here is the reference in the
upstream doc for others:
https://man.openbsd.org/OpenBSD-6.3/setlocale.3
https://man.openbsd.org/OpenBSD-6.2/setlocale.3
> It seems like (1) we need to drop the --lc-collate version of this
> test too, or else adjust both tests to accept the error we get on
> OpenBSD as well as the normal error; (2) somebody really ought to
> crank up a modern OpenBSD critter that's running the TAP tests.
Using an alternate output looks adapted to me. Thanks for 9ffe227.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 04:13 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Robert Haas <robertmhaas@gmail.com>
2020-02-27 05:11 ` Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
@ 2020-02-27 14:25 ` Alvaro Herrera <alvherre@2ndquadrant.com>
1 sibling, 0 replies; 12+ messages in thread
From: Alvaro Herrera @ 2020-02-27 14:25 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: Robert Haas <robertmhaas@gmail.com>; pgsql-committers <pgsql-committers@lists.postgresql.org>
On 2020-Feb-27, Michael Paquier wrote:
> Now looking at the code of OpenBSD there could be an
> alternative: using a string longer than 256 characters if I read
> lib/libc/locale/setlocale.c correctly, but I'd rather not rely on
> that.
That seems awfully fragile. Belated +1 for not relying on that :-)
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
^ permalink raw reply [nested|flat] 12+ messages in thread
* pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
@ 2020-02-27 02:23 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 02:23 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
The original coding failed to properly quote those arguments, leading to
failures when using quotes in the values used. As the quoting can be
encoding-sensitive, the connection to the backend needs to be taken
before applying the correct quoting.
Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200214041004.GB1998@paquier.xyz
Backpatch-through: 9.5
Branch
------
REL_12_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/943affb3d1db38ba0960ee9a0666ea2598b78f1f
Modified Files
--------------
src/bin/scripts/createdb.c | 29 +++++++++++++++++++----------
src/bin/scripts/t/020_createdb.pl | 26 +++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 11 deletions(-)
^ permalink raw reply [nested|flat] 12+ messages in thread
* pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
@ 2020-02-27 02:23 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 02:23 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
The original coding failed to properly quote those arguments, leading to
failures when using quotes in the values used. As the quoting can be
encoding-sensitive, the connection to the backend needs to be taken
before applying the correct quoting.
Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200214041004.GB1998@paquier.xyz
Backpatch-through: 9.5
Branch
------
REL_11_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/83bd732eb2c83a26db9eefb4595615fa289620a8
Modified Files
--------------
src/bin/scripts/createdb.c | 29 +++++++++++++++++++----------
src/bin/scripts/t/020_createdb.pl | 26 +++++++++++++++++++++++++-
2 files changed, 44 insertions(+), 11 deletions(-)
^ permalink raw reply [nested|flat] 12+ messages in thread
* pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
@ 2020-02-27 02:23 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 02:23 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
The original coding failed to properly quote those arguments, leading to
failures when using quotes in the values used. As the quoting can be
encoding-sensitive, the connection to the backend needs to be taken
before applying the correct quoting.
Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200214041004.GB1998@paquier.xyz
Backpatch-through: 9.5
Branch
------
REL_10_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/240c7c75f3a9946509c9c6f9f5062b56cec627ae
Modified Files
--------------
src/bin/scripts/createdb.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
^ permalink raw reply [nested|flat] 12+ messages in thread
* pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
@ 2020-02-27 02:23 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 02:23 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
The original coding failed to properly quote those arguments, leading to
failures when using quotes in the values used. As the quoting can be
encoding-sensitive, the connection to the backend needs to be taken
before applying the correct quoting.
Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200214041004.GB1998@paquier.xyz
Backpatch-through: 9.5
Branch
------
REL9_6_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/3340034f2c19730c1253dacbb07c3bf4f44f49af
Modified Files
--------------
src/bin/scripts/createdb.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
^ permalink raw reply [nested|flat] 12+ messages in thread
* pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
@ 2020-02-27 02:23 Michael Paquier <michael@paquier.xyz>
0 siblings, 0 replies; 12+ messages in thread
From: Michael Paquier @ 2020-02-27 02:23 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
The original coding failed to properly quote those arguments, leading to
failures when using quotes in the values used. As the quoting can be
encoding-sensitive, the connection to the backend needs to be taken
before applying the correct quoting.
Author: Michael Paquier
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/20200214041004.GB1998@paquier.xyz
Backpatch-through: 9.5
Branch
------
REL9_5_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/49300e4cf2da9988eb5caa94f18779cfa72ec698
Modified Files
--------------
src/bin/scripts/createdb.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2021-01-08 01:48 UTC | newest]
Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 04:13 ` Robert Haas <robertmhaas@gmail.com>
2020-02-27 05:11 ` Michael Paquier <michael@paquier.xyz>
2020-02-27 13:01 ` Michael Paquier <michael@paquier.xyz>
2021-01-07 22:25 ` Tom Lane <tgl@sss.pgh.pa.us>
2021-01-08 01:48 ` Michael Paquier <michael@paquier.xyz>
2020-02-27 14:25 ` Alvaro Herrera <alvherre@2ndquadrant.com>
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
2020-02-27 02:23 pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox