Postgresql Windows build and modern perl (>=5.28)
Victor Wagner <vitus@wagner.pp.ru>
From: Victor Wagner <vitus@wagner.pp.ru>
To: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-05-01T10:47:11Z
Lists: pgsql-hackers
Attachments
- perl.5.30.patch (text/x-patch) patch
Collegues,
Postgresql embeded perl, plperl contain code long time ago copied
from POSIX.xs file in the perl distribution.
It is function setlocale_perl, which does some allocation of
perl-specific locale data using functions(or macros) new_ctype,
new_collate and new_numeric.
This is used only for WIN32, because as comment in the code said:
/*
* The perl library on startup does horrible things like call
* setlocale(LC_ALL,""). We have protected against that on most platforms
* by setting the environment appropriately. However, on Windows,
* setlocale() does not consult the environment, so we need to save the
* existing locale settings before perl has a chance to mangle them and
* restore them after its dirty deeds are done.
*
* MSDN ref:
* http://msdn.microsoft.com/library/en-us/vclib/html/_crt_locale.asp
*
* It appears that we only need to do this on interpreter startup, and
* subsequent calls to the interpreter don't mess with the locale
* settings.
*
* We restore them using setlocale_perl(), defined below, so that Perl
* doesn't have a different idea of the locale from Postgres.
*
*/
This worked up to perl 5.26. But in perl 5.28 these macros and
corresponding functions became strictly private. However public
function Perl_setlocale appeared in libperl, which from the quick
glance to the code does the same thing as setlocale_perl in plperl code.
Attached patch makes use of this function if PERL_VERSION >= 28.
It makes plperl compile with ActiveStatePerl 5.28 and StrawberryPerl
5.30.2.1.
However, I'm not sure that I've choose correct approach. May be perl
just no more does horrible things with locale at startup?
--
Commits
-
plperl: windows: Use Perl_setlocale on 5.28+, fixing compile failure.
- 2557a03f8906 10.20 landed
- ad95a639ab09 11.15 landed
- f173738d5656 12.10 landed
- 0dc0fe7b6c45 13.6 landed
- 8484e38126d7 14.2 landed
- c89f409749c3 15.0 landed