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