pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-committers <pgsql-committers@lists.postgresql.org>
Subject: Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
Date: Thu, 27 Feb 2020 14:11:12 +0900
Message-ID: <20200227051112.GA280980@paquier.xyz> (raw)
In-Reply-To: <CA+TgmoZ6ddh3mHD9gU8DvNYoFmuJaYYn1+4AvZNp25vTdRwCAQ@mail.gmail.com>
References: <E1j78pp-0005GG-Ao@gemulon.postgresql.org>
	<CA+TgmoZ6ddh3mHD9gU8DvNYoFmuJaYYn1+4AvZNp25vTdRwCAQ@mail.gmail.com>

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

view thread (12+ messages)  latest in thread

Message-ID: <20200227051112.GA280980@paquier.xyz>
Permalink:  ../20200227051112.GA280980@paquier.xyz/
Also on:    postgresql.org/message-id/20200227051112.GA280980@paquier.xyz

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, robertmhaas@gmail.com
  Subject: Re: pgsql: createdb: Fix quoting of --encoding, --lc-ctype and --lc-collate
  In-Reply-To: <20200227051112.GA280980@paquier.xyz>
  References: <E1j78pp-0005GG-Ao@gemulon.postgresql.org> <CA+TgmoZ6ddh3mHD9gU8DvNYoFmuJaYYn1+4AvZNp25vTdRwCAQ@mail.gmail.com> <20200227051112.GA280980@paquier.xyz>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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