Public bug reported:

`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|LC_ALL|LC_CTYPE)='
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_ALL=en_GB.utf8

% sudo pg_createcluster --locale C 9.4 test1
Creating new cluster 9.4/test1 ...
  config /etc/postgresql/9.4/test1
  data   /var/lib/postgresql/9.4/test1
  locale en_GB.utf8
Flags of /var/lib/postgresql/9.4/test1 set as -------------e-C
  port   5434

% export LC_CTYPE='C'
% sudo pg_createcluster --locale C 9.4 test2
Creating new cluster 9.4/test2 ...
  config /etc/postgresql/9.4/test2
  data   /var/lib/postgresql/9.4/test2
  locale C
Flags of /var/lib/postgresql/9.4/test2 set as -------------e-C
  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";

** Affects: postgresql-common (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1467061

Title:
  pg_createcluster prints wrong locale

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/postgresql-common/+bug/1467061/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to