Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b124104

Browse files
committed
Fix Utils.pm's locale-munging so that Perl itself is also affected.
Utils.pm has a BEGIN block that editorializes on the locale-related environment variables, primarily in order to stabilize the behavior of child programs. It turns out that if the calling test script has already done "use locale", this fails to affect the behavior of Perl itself, causing locale behavior to be different between Perl and child programs. That breaks commit cd82e5c's attempt to deal with locale-specific behavior in psql. To fix, we just need to call setlocale() to redo the calculation of locale. Per report from Aleksander Alekseev. No back-patch for now, since there are no locale-dependent TAP tests in prior branches, and I'm not yet convinced that this won't have side-effects of its own. Discussion: https://postgr.es/m/CAJ7c6TO9KpYYxoVVseWEQB5KtjWDkt8NfyAeKPcHoe2Jq+ykpw@mail.gmail.com
1 parent 363e8f9 commit b124104

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/test/perl/PostgreSQL/Test/Utils.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ use File::Spec;
5555
use File::stat qw(stat);
5656
use File::Temp ();
5757
use IPC::Run;
58+
use POSIX qw(locale_h);
5859
use PostgreSQL::Test::SimpleTee;
5960

6061
# We need a version of Test::More recent enough to support subtests
@@ -103,6 +104,7 @@ BEGIN
103104
delete $ENV{LANGUAGE};
104105
delete $ENV{LC_ALL};
105106
$ENV{LC_MESSAGES} = 'C';
107+
setlocale(LC_ALL, "");
106108

107109
# This list should be kept in sync with pg_regress.c.
108110
my @envkeys = qw (

0 commit comments

Comments
 (0)