From debbugs-submit-bounces@debbugs.gnu.org Sat Feb 06 09:22:33 2016 Received: (at submit) by debbugs.gnu.org; 6 Feb 2016 14:22:33 +0000 Received: from localhost ([127.0.0.1]:35204 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aS3kv-0002UE-93 for submit@debbugs.gnu.org; Sat, 06 Feb 2016 09:22:33 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52776) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aS3ku-0002Ty-1n for submit@debbugs.gnu.org; Sat, 06 Feb 2016 09:22:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aS3ko-0005LQ-8q for submit@debbugs.gnu.org; Sat, 06 Feb 2016 09:22:26 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:51283) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS3ko-0005LK-5o for submit@debbugs.gnu.org; Sat, 06 Feb 2016 09:22:26 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43745) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS3kn-000778-8Q for bug-guix@gnu.org; Sat, 06 Feb 2016 09:22:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aS3kj-0005HY-W3 for bug-guix@gnu.org; Sat, 06 Feb 2016 09:22:25 -0500 Received: from world.peace.net ([50.252.239.5]:44525) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aS3kj-0005H4-ST for bug-guix@gnu.org; Sat, 06 Feb 2016 09:22:21 -0500 Received: from [10.1.10.78] (helo=jojen) by world.peace.net with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1aS3kd-0006Kl-G5; Sat, 06 Feb 2016 09:22:15 -0500 From: Mark H Weaver To: bug-guix@gnu.org Subject: Handling of system 'locale' field needs improvement Date: Sat, 06 Feb 2016 09:22:14 -0500 Message-ID: <87k2mhudex.fsf@netris.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Multiple users on #guix have been bitten by the following error message: guix system: error: system locale lacks a definition and even several seasoned developers on #guix didn't know the answer. At minimum, the error message should be improved to point to the relevant documentation. Better yet, the value of the 'locale' field should be automatically added to the default value of 'locale-definitions' if it's not already there. The overwhelming majority of users set their 'locale' and have no interest in 'locale-definitions'. Regards, Mark From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 07 16:19:56 2016 Received: (at 22572) by debbugs.gnu.org; 7 Feb 2016 21:19:56 +0000 Received: from localhost ([127.0.0.1]:37619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aSWkN-0001yT-Sd for submit@debbugs.gnu.org; Sun, 07 Feb 2016 16:19:56 -0500 Received: from eggs.gnu.org ([208.118.235.92]:40866) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aSWkM-0001yH-Oi for 22572@debbugs.gnu.org; Sun, 07 Feb 2016 16:19:55 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aSWkE-0001ip-F5 for 22572@debbugs.gnu.org; Sun, 07 Feb 2016 16:19:49 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:44794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aSWkE-0001il-BI; Sun, 07 Feb 2016 16:19:46 -0500 Received: from reverse-83.fdn.fr ([80.67.176.83]:52640 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aSWkC-000174-SS; Sun, 07 Feb 2016 16:19:45 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Mark H Weaver Subject: Re: bug#22572: Handling of system 'locale' field needs improvement References: <87k2mhudex.fsf@netris.org> Date: Sun, 07 Feb 2016 22:19:42 +0100 In-Reply-To: <87k2mhudex.fsf@netris.org> (Mark H. Weaver's message of "Sat, 06 Feb 2016 09:22:14 -0500") Message-ID: <871t8orzf5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.3 (-----) X-Debbugs-Envelope-To: 22572 Cc: 22572@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.3 (-----) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mark H Weaver skribis: > Better yet, the value of the 'locale' field should be automatically > added to the default value of 'locale-definitions' if it's not already > there. The overwhelming majority of users set their 'locale' and have > no interest in 'locale-definitions'. What about this? This is not ideal in that it guesses the charset based on the locale name, which won=E2=80=99t always work (the locale name is sup= posed to use the normalized name, like =E2=80=9Cutf8=E2=80=9D, whereas the real n= ame is, say, =E2=80=9CUTF-8=E2=80=9D), but it should cover 90% of the use cases. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable diff --git a/doc/guix.texi b/doc/guix.texi index 66ab384..f35a9fe 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6452,11 +6452,12 @@ Usually, you will want to specify the default local= e for the machine using the @code{locale} field of the @code{operating-system} declaration (@pxref{operating-system Reference, @code{locale}}). =20 -That locale must be among the @dfn{locale definitions} that are known to -the system---and these are specified in the @code{locale-definitions} -slot of @code{operating-system}. The default value includes locale -definitions for some widely used locales, but not for all the available -locales, in order to save space. +The selected locale is automatically added to the @dfn{locale +definitions} known to the system. Additional locale definitions can be +specified in the @code{locale-definitions} slot of +@code{operating-system}. The default value includes locale definitions +for some widely used locales, but not for all the available locales, in +order to save space. =20 If the locale specified in the @code{locale} field is not among the definitions listed in @code{locale-definitions}, @command{guix system} diff --git a/gnu/system.scm b/gnu/system.scm index d4759a0..324d071 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -669,14 +669,25 @@ hardware-related operations as necessary when booting= a Linux container." "Return the directory containing the locales compiled for the definitions listed in OS. The C library expects to find it under /run/current-system/locale." - ;; While we're at it, check whether the locale of OS is defined. - (unless (member (operating-system-locale os) - (map locale-definition-name - (operating-system-locale-definitions os))) - (raise (condition - (&message (message "system locale lacks a definition"))))) + (define name + (operating-system-locale os)) =20 - (locale-directory (operating-system-locale-definitions os) + (define definitions + ;; While we're at it, check whether the locale of OS is defined. + (if (member (operating-system-locale os) + (map locale-definition-name + (operating-system-locale-definitions os))) + (operating-system-locale-definitions os) + (cons (match (locale-name->definition name) + (#f + (raise (condition + (&message + (message (format #f (_ "~a: invalid locale name") + name)))))) + (def def)) + (operating-system-locale-definitions os)))) + + (locale-directory definitions #:libcs (operating-system-locale-libcs os))) =20 (define (kernel->grub-label kernel) diff --git a/gnu/system/locale.scm b/gnu/system/locale.scm index e798827..9d695b3 100644 --- a/gnu/system/locale.scm +++ b/gnu/system/locale.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright =C2=A9 2014, 2015 Ludovic Court=C3=A8s +;;; Copyright =C2=A9 2014, 2015, 2016 Ludovic Court=C3=A8s ;;; ;;; This file is part of GNU Guix. ;;; @@ -33,6 +33,7 @@ locale-definition-source locale-definition-charset =20 + locale-name->definition locale-directory =20 %default-locale-libcs @@ -52,6 +53,22 @@ (charset locale-definition-charset ;string--e.g., "UTF-8" (default "UTF-8"))) =20 +(define %not-dot + (char-set-complement (char-set #\.))) + +(define (locale-name->definition name) + "Return a corresponding to NAME, guessing the charse= t, +or #f on failure." + (match (string-tokenize name %not-dot) + ((source charset) + (locale-definition (name name) + (source source) + (charset (if (string-ci=3D? charset "utf8") + "UTF-8" + charset)))) + (_ + #f))) + (define* (localedef-command locale #:key (libc (canonical-package glibc))) "Return a gexp that runs 'localedef' from LIBC to build LOCALE." --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpUaGFua3MsDQpMdWRv4oCZLg0K --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 10 09:20:51 2016 Received: (at 22572-done) by debbugs.gnu.org; 10 Feb 2016 14:20:52 +0000 Received: from localhost ([127.0.0.1]:34348 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aTVdT-0007IO-Nt for submit@debbugs.gnu.org; Wed, 10 Feb 2016 09:20:51 -0500 Received: from eggs.gnu.org ([208.118.235.92]:45176) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aTVdR-0007I9-UK for 22572-done@debbugs.gnu.org; Wed, 10 Feb 2016 09:20:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTVdI-0005ER-Qz for 22572-done@debbugs.gnu.org; Wed, 10 Feb 2016 09:20:44 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:37085) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTVdI-0005EM-Mu; Wed, 10 Feb 2016 09:20:40 -0500 Received: from reverse-83.fdn.fr ([80.67.176.83]:58492 helo=pluto) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aTVdH-0000dR-KA; Wed, 10 Feb 2016 09:20:40 -0500 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: Mark H Weaver Subject: Re: bug#22572: Handling of system 'locale' field needs improvement References: <87k2mhudex.fsf@netris.org> <871t8orzf5.fsf@gnu.org> Date: Wed, 10 Feb 2016 15:20:37 +0100 In-Reply-To: <871t8orzf5.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Sun, 07 Feb 2016 22:19:42 +0100") Message-ID: <87k2mclk96.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.3 (-----) X-Debbugs-Envelope-To: 22572-done Cc: 22572-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.3 (-----) ludo@gnu.org (Ludovic Court=C3=A8s) skribis: > Mark H Weaver skribis: > >> Better yet, the value of the 'locale' field should be automatically >> added to the default value of 'locale-definitions' if it's not already >> there. The overwhelming majority of users set their 'locale' and have >> no interest in 'locale-definitions'. > > What about this? This is not ideal in that it guesses the charset based > on the locale name, which won=E2=80=99t always work (the locale name is s= upposed > to use the normalized name, like =E2=80=9Cutf8=E2=80=9D, whereas the real= name is, say, > =E2=80=9CUTF-8=E2=80=9D), but it should cover 90% of the use cases. I pushed an improved version of the patch as f5582b2. Ludo=E2=80=99. From unknown Sun Jun 22 20:57:50 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 10 Mar 2016 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator