From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uHjHAt37XmINOAEAbAwnHQ (envelope-from ) for ; Tue, 19 Apr 2022 20:13:49 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id yDTEAt37XmKRIgEAauVa8A (envelope-from ) for ; Tue, 19 Apr 2022 20:13:49 +0200 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 9E424100E1 for ; Tue, 19 Apr 2022 20:13:48 +0200 (CEST) Received: from localhost ([::1]:60676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ngsMD-0001dZ-9h for larch@yhetil.org; Tue, 19 Apr 2022 14:13:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ngsLW-0000nK-NX for bug-guix@gnu.org; Tue, 19 Apr 2022 14:13:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50185) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ngsLW-0006Vo-BX for bug-guix@gnu.org; Tue, 19 Apr 2022 14:13:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ngsLW-00048I-5M for bug-guix@gnu.org; Tue, 19 Apr 2022 14:13:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#54893: [PATCH] guix: git-download: Set locale to deal with Unicode in git metadata. References: In-Reply-To: Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 19 Apr 2022 18:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54893 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 54893@debbugs.gnu.org Received: via spool by 54893-submit@debbugs.gnu.org id=B54893.165039192615817 (code B ref 54893); Tue, 19 Apr 2022 18:13:02 +0000 Received: (at 54893) by debbugs.gnu.org; 19 Apr 2022 18:12:06 +0000 Received: from localhost ([127.0.0.1]:44082 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ngsKc-000473-6k for submit@debbugs.gnu.org; Tue, 19 Apr 2022 14:12:06 -0400 Received: from mail-ej1-f53.google.com ([209.85.218.53]:37487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ngsKa-00046Y-JH for 54893@debbugs.gnu.org; Tue, 19 Apr 2022 14:12:04 -0400 Received: by mail-ej1-f53.google.com with SMTP id g13so6859385ejb.4 for <54893@debbugs.gnu.org>; Tue, 19 Apr 2022 11:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=oPMirPXaNqaUKVCh1kbQV00gtS/MM3BC36m6OU58du8=; b=TnSbaalwIAQJlcUL+UhksRApl4YimXFqCRRHt9G7wQf9cJhAOBq7qm0xqb2iOG3C9O SsRnu0JDgMZyLg39hft/4NCx+gZ2PvRhcGEebrZeYGmpezrj0cdu7hwqTS1DRcJXA38P kvB9QuPKlXhjEobd7zGAf/OMtBLhPhDqocaIQPcjyjmGsvdq2t8uEIetiTbSPxPTdhO6 wiezKpJwGbj+tMJdb/rMyYX7BQ6dxWy0KTz/GGoOw7U9p0xCsWAyVKHL1sI7xF21DZbq xeT8ONZ6jNDNi6OkvA3HvkYHfHuQMh7b9sQdCSIvVPqdMNo0JCVWXfX+jKRHCOeQ8kSS zRdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=oPMirPXaNqaUKVCh1kbQV00gtS/MM3BC36m6OU58du8=; b=A43HIK6QsUuwZdo8ZioCr9xeYIRy01/mbL65rjd0scnGnrcsovg/A9hKdQVbwwUmu7 JUSD87yjBvJrzEiJyS5XsQZQr0KWFfr5sPlOAaoc3+ilzLl6PTSZpzE6ha/FEbGAKmP0 h1Q52l3M7yCEypTVvATYshqEamJqiY3slqUN0gujT2buO+OkSHspPpZsyJn/C71LmMZs ECjAqvVIjXeWz2w8geackAsJyOwvFVBeHQ3Lt6TLew7xiPHaw8xa7Gk7TncWOENIGkXI eCBiP8b2RV5wt4beNxDuiu23f0eUWbb9Oo4ljaWt3Pnn/Dr+2Z8f4nAwkmFqpwxxFr2u IUYg== X-Gm-Message-State: AOAM530aLsHlszfZG2J10f3b/I8yX0QS2y6tn8AEaH4M9zTrRyp+xhHo zBhhNdMgatveaxjsML6DNacuNXSgkC4= X-Google-Smtp-Source: ABdhPJyFghx6sCVRNSND963jh0kllFzEkqQquSfaGCw6npscw4ySjN/3I8UMnIYRKJstXczN7XOxdQ== X-Received: by 2002:a17:907:a425:b0:6ef:8e2f:4215 with SMTP id sg37-20020a170907a42500b006ef8e2f4215mr11943199ejc.283.1650391918683; Tue, 19 Apr 2022 11:11:58 -0700 (PDT) Received: from lelap.local (catv-89-132-245-188.catv.fixed.vodafone.hu. [89.132.245.188]) by smtp.gmail.com with ESMTPSA id n16-20020a05640204d000b0042062f9f0e1sm8808264edw.15.2022.04.19.11.11.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Apr 2022 11:11:57 -0700 (PDT) From: Attila Lendvai Date: Tue, 19 Apr 2022 20:09:55 +0200 Message-Id: <20220419180954.9636-1-attila@lendvai.name> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Attila Lendvai Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650392028; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=oPMirPXaNqaUKVCh1kbQV00gtS/MM3BC36m6OU58du8=; b=Ljn/Qb3X4mNnarm3HdjRPGaQIYxMfz5CdNgOIGTX2blWUJwMCIv1rokabtUpAeK5cQzxfb aY/BodZOkBX3eX0/Sf1S3jzmqfzsLc29rfNHXQn2CLpGT1g86iKbRwOYQskroqfyY27hqC 9K45hiW7qsyybw6p2d52UgV8QP6AiHtvk8nHYN6elRfhF6FUQ1LiZmmjntkjf7CUKgJ8tC N4lHdMCjRJvyhnmYQh9Ulw7w08LOdlmXWgZ9rxhaB+bETFZQmRPpH2PEVgWGEFQux3FdmX owiZJu56AwPo1BRJH64K7qDEGEbXAEMbl+GkLsn1IBjdOeMMYDw+UV5CRB3OHg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650392028; a=rsa-sha256; cv=none; b=Xw2iIdraDf9EGPtCS0Ex0Qx3JX4jU1HJ3aHvsO08Pq9JVLkvdjVR5RlDpNkchiTujsFy3Y dO8iQ9BFeHMluNDJMk4f5ZhB8rCh6R0cHThWhTXLrJDCnVKR/JBHHPdvBSo8orSC+0FKLi 71GXphj6691lIjnIcaaKo71SnZITac+5LSbAobl4p4KAADWvAweoUoLHMMjmw0O2y9D1k+ oDw+3f2TEtdLUpDVIKFi1HIfNH+kGIyusU4K5NhHUeZWwyrXhAbyp+P33vGt1yewB+Iu+U OxutcR5PalRfbeVO0yTPbYvBb7atqRvHrkmMo9dyMuAzJjABIkXEvwSheCUe5Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=TnSbaalw; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.36 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=TnSbaalw; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "bug-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="bug-guix-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 9E424100E1 X-Spam-Score: 1.36 X-Migadu-Scanner: scn0.migadu.com X-TUID: 2sinEP1VTvtJ Without this the git-fetch GEXP is run in an environment that uses ASCII character encoding when strings are crossing the Guile - C boundary. It means that e.g. tag names that have Unicode chars in them will cause problems, e.g. when walking and deleting the .git directory. An example in the wild: https://github.com/klauspost/pgzip/tags For more details see: https://issues.guix.gnu.org/54893 * guix/git-download.scm (git-fetch): Call setlocale to set it to en_US.utf8. --- thanks Maxime, this indeed seems to work! and i have successfully guix pull'ed it, too. guix/git-download.scm | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/guix/git-download.scm b/guix/git-download.scm index 5e624b9ae9..2fc5a06490 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -104,6 +104,9 @@ (define guile-zlib (define gnutls (module-ref (resolve-interface '(gnu packages tls)) 'gnutls)) + (define glibc-locales + (module-ref (resolve-interface '(gnu packages base)) 'glibc-locales)) + (define modules (delete '(guix config) (source-module-closure '((guix build git) @@ -121,6 +124,13 @@ (define build (guix build download-nar) (guix swh) (ice-9 match)) + ;; We must set the locale to something/anything that will make the + ;; Guile FFI use a character encoding that is idempotent through a + ;; bytes->string string->bytes roundtrip. Otherwise e.g. git tags + ;; with Unicode characters would break things. For more details + ;; and an example see https://issues.guix.gnu.org/54893 + (setenv "GUIX_LOCPATH" #+(file-append glibc-locales "/lib/locale")) + (setlocale LC_ALL "en_US.utf8") (define recursive? (call-with-input-string (getenv "git recursive?") read)) -- 2.35.1