From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH 2/2] services: postgresql: Add locale to configuration Date: Mon, 12 Dec 2016 00:14:39 +0100 Message-ID: <87shpuxdls.fsf@gnu.org> References: <20161211211301.28403-1-mail@cbaines.net> <20161211211301.28403-2-mail@cbaines.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:55421) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cGDKQ-000245-HA for guix-devel@gnu.org; Sun, 11 Dec 2016 18:14:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cGDKN-0007mV-82 for guix-devel@gnu.org; Sun, 11 Dec 2016 18:14:46 -0500 In-Reply-To: <20161211211301.28403-2-mail@cbaines.net> (Christopher Baines's message of "Sun, 11 Dec 2016 21:13:01 +0000") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Christopher Baines Cc: guix-devel@gnu.org Hi! Christopher Baines skribis: > * gnu/services/postgresql.scm (): Add locale > field. > (postgresql-shepherd-service): Pass locale to initdb. > (postgresql-service): Add locale default. [...] > + (locale postgresql-configuration-locale > + (default "en_US.UTF-8")) Note: this should use the =E2=80=9Cnormalized codeset=E2=80=9D, so =E2=80= =9Cen_US.utf8=E2=80=9D. > (let ((user (getpwnam "postgres")) > - (initdb (string-append #$postgresql "/bin/initdb"))) > + (initdb (string-append #$postgresql "/bin/initdb")) > + (initdb-args > + (append > + (if #$locale > + (list (string-append "--locale=3D" #$locale)) > + '())))) > ;; Create db state directory. > (mkdir-p #$data-directory) > (chown #$data-directory (passwd:uid user) (passwd:gid user)) > @@ -103,14 +110,19 @@ host all all ::1/128 trust")) > (lambda () > (setgid (passwd:gid user)) > (setuid (passwd:uid user)) > - (primitive-exit (system* initdb "-D" #$data-directory)= )) > + (primitive-exit > + (apply system* > + initdb > + "-D" > + #$data-directory > + initdb-args))) > (lambda () > (primitive-exit 1)))) > (pid (waitpid pid)))))))) The effect of that is that =E2=80=98initdb=E2=80=99, but not =E2=80=98postg= resql=E2=80=99 itself, would run in a locale different from the system locale by default. These two inconsistencies may be quite confusing. WDYT? Thanks, Ludo=E2=80=99.