pg_createcluster prints wrong locale
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
postgresql-common (Ubuntu) |
Fix Released
|
Low
|
Unassigned |
Bug Description
`pg_createcluster` accepts a `--locale` option that tells it what locale it should create the new cluster with. During the creation process, the script prints information about the settings it's about to use. When it does this, it ignores the user-provided `--locale` value and instead prints the current `LC_CTYPE` environment setting.
Illustration:
% locale | grep -iE '(LANG|
LANG=en_GB.utf8
LC_CTYPE=
LC_ALL=en_GB.utf8
% sudo pg_createcluster --locale C 9.4 test1
Creating new cluster 9.4/test1 ...
config /etc/postgresql
data /var/lib/
locale en_GB.utf8
Flags of /var/lib/
port 5434
% export LC_CTYPE='C'
% sudo pg_createcluster --locale C 9.4 test2
Creating new cluster 9.4/test2 ...
config /etc/postgresql
data /var/lib/
locale C
Flags of /var/lib/
port 5435
Note that `pg_createcluster` DOES in fact use the expected locale setting when it creates the cluster — it just prints the wrong one (which is very confusing).
I believe the fix is as simple as this:
*** a/pg_createcluster 2015-06-20 02:38:52.000000000 -0500
--- b/pg_createcluster 2015-06-20 02:39:09.000000000 -0500
***************
*** 363,367 ****
}
} else {
! my $loc = setlocale (LC_CTYPE);
print "Creating new cluster $version/$cluster ...\n";
print " config $confdir\n data $datadir\n locale $loc\n";
--- 363,367 ----
}
} else {
! my $loc = $locale || setlocale (LC_CTYPE);
print "Creating new cluster $version/$cluster ...\n";
print " config $confdir\n data $datadir\n locale $loc\n";
Thanks! Applied in https:/ /anonscm. debian. org/cgit/ pkg-postgresql/ postgresql- common. git/commit/ ?id=b3930de