From unknown Sun Jun 22 22:41:32 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#75007 <75007@debbugs.gnu.org> To: bug#75007 <75007@debbugs.gnu.org> Subject: Status: [PATCH] guile-launcher: Avoid the =?UTF-8?Q?=E2=80=9CC=E2=80=9D?= locale and try =?UTF-8?Q?=E2=80=9CC.UTF-8=E2=80=9D.?= Reply-To: bug#75007 <75007@debbugs.gnu.org> Date: Mon, 23 Jun 2025 05:41:32 +0000 retitle 75007 [PATCH] guile-launcher: Avoid the =E2=80=9CC=E2=80=9D locale = and try =E2=80=9CC.UTF-8=E2=80=9D. reassign 75007 guix-patches submitter 75007 Ludovic Court=C3=A8s severity 75007 normal tag 75007 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 21 05:44:43 2024 Received: (at submit) by debbugs.gnu.org; 21 Dec 2024 10:44:43 +0000 Received: from localhost ([127.0.0.1]:45424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOwyQ-0002Pa-V0 for submit@debbugs.gnu.org; Sat, 21 Dec 2024 05:44:43 -0500 Received: from lists.gnu.org ([209.51.188.17]:46084) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOwyP-0002PQ-5L for submit@debbugs.gnu.org; Sat, 21 Dec 2024 05:44:41 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOwyO-0000p9-Vd for guix-patches@gnu.org; Sat, 21 Dec 2024 05:44:40 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOwyO-0003GV-0h; Sat, 21 Dec 2024 05:44:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=oGJ0qX28SCx8PvvY3IRdmYyzZKHUbfx49X1c9ZCkSBQ=; b=Uc69dQOZXIl9bd K+HOktfnJxkq3Yp7JGgWjB6ZF5E+B2W14FIUG+GQPgFHqqz29qS9UAGF0peCk6tVCDXEi/Vo+dLdS f74gRaxXZ5oBt93P7Ebemyr0FathQ5WwaZe4eKjqKWMt6NTiRWcHhF0/qOkvXGVclGG1Ib09gVvgV 7m/CKkqY3EoDqfqxVZuKTrFoZ2Sy70JsWw+VcFhF6kRCpXeSWu6gJnGECRe+9VFAIqmk0nBHDNtTP aTFIjQ7LBVy90PSxoju1E7ZTxCLK0lQBwmy6VSsjQ0dZXL7PhRmQghMdFbiNIhK97oGSgzK0uqxZ6 tJYYhMY7efw7QNwTjOZQ==; From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH] =?UTF-8?q?guile-launcher:=20Avoid=20the=20=E2=80=9CC?= =?UTF-8?q?=E2=80=9D=20locale=20and=20try=20=E2=80=9CC.UTF-8=E2=80=9D.?= Date: Sat, 21 Dec 2024 11:44:27 +0100 Message-ID: <24813952576725c0d7f6478543eec8e2747d525d.1734777730.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Debbugs-Cc: Christopher Baines , Josselin Poiret , Ludovic Courtès , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= 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: -3.3 (---) This is a followup to ed0cd12a82b429bc5058f693a0f75f2ba0ee47c4, which adds the C.UTF-8 locale to the glibc package, and ee4e79f871bc2f848ce4b4a176bb725ab71e3cd6, which changed the default to “C.UTF-8” for ‘guix’ commands. Fixes a bug whereby starting ‘guix’ in an environment where the LC_* variables are unset would start it in the “C” locale: echo '(pk (setlocale LC_ALL))' | guix shell -CW coreutils -- guix repl This would lead to breakage for commands such as ‘guix substitute’ that need to run in a UTF-8 locale. * gnu/packages/aux-files/guile-launcher.c (main): Try “C.UTF-8” before “en_US.UTF-8”. Do that also when the current locale is “C”. * guix/ui.scm (install-locale): Likewise. Change-Id: I36da4db8f898f1083b33760e1ab46c3a257de811 --- gnu/packages/aux-files/guile-launcher.c | 16 +++++++++++----- guix/ui.scm | 4 +++- 2 files changed, 14 insertions(+), 6 deletions(-) Hi! Until now, ‘guix’ wouldn’t mind running in the C locale, but that’s not good for ‘guix substitute’ and other commands started by ‘guix-daemon’. This is something colleagues and I noticed while running ‘guix-daemon’ in a GitLab-CI container where LC_* were unset. Thoughts? Ludo’. diff --git a/gnu/packages/aux-files/guile-launcher.c b/gnu/packages/aux-files/guile-launcher.c index c205477f64..44f7e1f432 100644 --- a/gnu/packages/aux-files/guile-launcher.c +++ b/gnu/packages/aux-files/guile-launcher.c @@ -84,11 +84,17 @@ int main (int argc, char **argv) { /* Try to install the current locale; remain silent if it fails. */ - if (setlocale (LC_ALL, "") == NULL) - /* The 'guix pull'-provided 'guix' includes at least en_US.utf8 so use - that. That gives us UTF-8 support for 'scm_to_locale_string', etc., - which is always preferable over the C locale. */ - setlocale (LC_ALL, "en_US.utf8"); + char *locale = setlocale (LC_ALL, ""); + if (locale == NULL || strcmp (locale, "C") == 0) + { + /* The 'guix pull'-provided 'guix' includes at least C.UTF-8 (which is + baked into glibc, except when cross-compiling) so use that, and fall + back to en_US.UTF-8. That gives us UTF-8 support for + 'scm_to_locale_string', etc., which is always preferable over the C + locale. */ + if (setlocale (LC_ALL, "C.UTF-8") == NULL) + setlocale (LC_ALL, "en_US.utf8"); + } const char *str; str = getenv ("GUILE_LOAD_PATH"); diff --git a/guix/ui.scm b/guix/ui.scm index eba12c8616..14d6874795 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -521,7 +521,9 @@ (define (install-locale) "Install the current locale settings." (catch 'system-error (lambda _ - (setlocale LC_ALL "")) + (when (string=? (setlocale LC_ALL "") "C") + ;; If the current locale is "C", prefer "C.UTF-8". + (setlocale LC_ALL "C.UTF-8"))) (lambda args (display-hint (G_ "Consider installing the @code{glibc-locales} package and defining @code{GUIX_LOCPATH}, along these lines: base-commit: 777fde8299d5b0050cae661d403374a7dd87f6ab -- 2.46.0 From debbugs-submit-bounces@debbugs.gnu.org Sat Jan 04 17:39:06 2025 Received: (at 75007-done) by debbugs.gnu.org; 4 Jan 2025 22:39:06 +0000 Received: from localhost ([127.0.0.1]:57860 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tUCnS-0000ie-9m for submit@debbugs.gnu.org; Sat, 04 Jan 2025 17:39:06 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:35994) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tUCnQ-0000ho-II for 75007-done@debbugs.gnu.org; Sat, 04 Jan 2025 17:39:05 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tUCnK-0004G2-AP; Sat, 04 Jan 2025 17:38:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=9VJHNyvAVMaQb1K1tPmh7Xtz3XOgq++skCgygE1PLR0=; b=JkG12otP4dHxPOO8DhhX rPHzQjnuFuc8p+AT+mmfVJzRjkrpmN8CbIabCmnWTv/+3etzWc/MPKi2l6RYGKyZRurMH/ih5XcXD xxZz5rFMU9y+6VY/pSy8cASzbiuJrNQnufKioniLRlTuDuHyvtTfddQaA7uKhenJJI6au0tWy7ObW lfNRyiWGz7cvY1QMXpDxbrYjr+JuSt8Y5H5GmtPio6ID/npdKKhQQWx36s4qbaU8JU+0+OQoJ1WPd CNyhTxahrg6YWnKogKAwYez3DDv0YDVzY7ssow7twOMGT0k+h6myyApdPCa2e3lGd/I8tC0fZdRx2 C0csiAPALqodbQ==; From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 75007-done@debbugs.gnu.org Subject: Re: [bug#75007] [PATCH] guile-launcher: Avoid the =?utf-8?B?4oCc?= =?utf-8?B?Q+KAnQ==?= locale and try =?utf-8?B?4oCcQy5VVEYtOOKAnS4=?= In-Reply-To: <24813952576725c0d7f6478543eec8e2747d525d.1734777730.git.ludo@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22's?= message of "Sat, 21 Dec 2024 11:44:27 +0100") References: <24813952576725c0d7f6478543eec8e2747d525d.1734777730.git.ludo@gnu.org> Date: Sat, 04 Jan 2025 23:38:55 +0100 Message-ID: <87h66enr0g.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 75007-done Cc: Tobias Geerinckx-Rice , Christopher Baines , Josselin Poiret , Simon Tournier , Mathieu Othacehe 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: -3.3 (---) Ludovic Court=C3=A8s skribis: > This is a followup to ed0cd12a82b429bc5058f693a0f75f2ba0ee47c4, which > adds the C.UTF-8 locale to the glibc package, and > ee4e79f871bc2f848ce4b4a176bb725ab71e3cd6, which changed the default to > =E2=80=9CC.UTF-8=E2=80=9D for =E2=80=98guix=E2=80=99 commands. > > Fixes a bug whereby starting =E2=80=98guix=E2=80=99 in an environment whe= re the LC_* > variables are unset would start it in the =E2=80=9CC=E2=80=9D locale: > > echo '(pk (setlocale LC_ALL))' | guix shell -CW coreutils -- guix repl > > This would lead to breakage for commands such as =E2=80=98guix substitute= =E2=80=99 that > need to run in a UTF-8 locale. > > * gnu/packages/aux-files/guile-launcher.c (main): Try =E2=80=9CC.UTF-8=E2= =80=9D before > =E2=80=9Cen_US.UTF-8=E2=80=9D. Do that also when the current locale is = =E2=80=9CC=E2=80=9D. > * guix/ui.scm (install-locale): Likewise. > > Change-Id: I36da4db8f898f1083b33760e1ab46c3a257de811 Pushed as d7c8a5ff3c76461d469364e920ec4f09f9e3c126. From unknown Sun Jun 22 22:41:32 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 02 Feb 2025 12:24:07 +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