From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id sASKG1KcZmcZ8wAAe85BDQ:P1 (envelope-from ) for ; Sat, 21 Dec 2024 10:45:38 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id sASKG1KcZmcZ8wAAe85BDQ (envelope-from ) for ; Sat, 21 Dec 2024 11:45:38 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=BPGVhbIx; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Uc69dQOZ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1734777938; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=oGJ0qX28SCx8PvvY3IRdmYyzZKHUbfx49X1c9ZCkSBQ=; b=RGIQDQf7jH/x+Mye1GYqI3cbxIwEC2qevidVxuoMIPih6mAosp1DteOJv44Hwd/JH/deJ8 2VVx5NzkTrmmpw0HSFOV976iJ8hcbpva3r3TOxV2Q1cDMVMVetZt0UQeMJKeKx1A2DAwSR QgwPlo8jmyDk/pFwyOEqp1rWzu0MYIy+pt59oyOPK6NhmNZrDr3dycarmluGq4QgYECrG7 QLiLddtlcYVFxWsXn/Wo6EQRgH5TZdbxSirKl6OcMdciT03pbbdp9SJv465NFN3tIXw8/f 1nJosurVVLg4Xs0NYFWXKZbQJoU2C3iCC9NNkbAeNW81pAD6rwU6UDhAX4xN7w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=BPGVhbIx; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=Uc69dQOZ; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Seal: i=1; s=key1; d=yhetil.org; t=1734777938; a=rsa-sha256; cv=none; b=cFPSAUkmAgx9mAc5OE9SsNuTvfd99o6n1+ptAIyHnMDXni9no0ejZRdL6wfYlvnsRgUWxk Tgfq3EyNhdi3qf4WAway6G51bRJXsAj2LkDypvCLi5sRNmLyhdXH7FUI4o3jHLIITV4Zl9 fkPxL6tMO9BkKrkF1Iwlayd0GUBCP3IhusQvwjqXtSGyZ3VJ68BQhCBAGMynRAqEk7S7gg XbjLP0UsC1YFJIYe1RrX2NOjswWhiSuBChPmG4uKljTWmxZynBGzPGo1QltqCK6MNvF8sh 4tzO0BCDwiAifej7tokA3+/+drI49umf1GK5TCgC4zjnONZkp5uZykLNkr8T1w== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2AEA6795F3 for ; Sat, 21 Dec 2024 11:45:37 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOwyt-0000w5-8k; Sat, 21 Dec 2024 05:45:11 -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 1tOwyp-0000tZ-4d for guix-patches@gnu.org; Sat, 21 Dec 2024 05:45:07 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tOwyo-0003TM-Rc; Sat, 21 Dec 2024 05:45:06 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=oGJ0qX28SCx8PvvY3IRdmYyzZKHUbfx49X1c9ZCkSBQ=; b=BPGVhbIxN85+Zy42iGGtm8qI5Ys25UsdpKTxgAkPoaSQKXvfBAtfjLnwKUL/h4YgA4xmd81gM/vmFbp+G1RK5CLwY2wyKQpIoTTJWYnAf6FxD6lUuFNw8WQ4W3EHdiDf8LRtmGzQ8BQN3k6iTLJbVcfwNg8meqlEfHbJLEO7zw04qxsVw1SyBk7cDax0gBU9cmd3kazopfFOXbNQmNGdYY4iUFYVu5JN2mukqc9a+9kmfm7NkCdgKiKrB4oI2dJCgYh/bbBh43JGcaOqB6fd0LvgQptmWtr9L71iBcluSP65Z0qCFR4+movqpWJFD5QTxmvvN+Dpr2l8YphVypHoIg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tOwyk-0002Qb-IA; Sat, 21 Dec 2024 05:45:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#75007] [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.?= Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Sat, 21 Dec 2024 10:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 75007 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 75007@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.17347778839278 (code B ref -1); Sat, 21 Dec 2024 10:45:02 +0000 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: Ludovic =?UTF-8?Q?Court=C3=A8s?= 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 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 2AEA6795F3 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: 0.59 X-Spam-Score: 0.59 X-TUID: 51CJfvQ5rRR+ 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