From patchwork Mon May 27 18:30:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tomas Volf <~@wolfsden.cz> X-Patchwork-Id: 64917 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 79BE727BBEA; Mon, 27 May 2024 19:35:11 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_ADSP_ALL, DKIM_INVALID,DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CFD9527BBE2 for ; Mon, 27 May 2024 19:35:10 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sBfBU-0007Xq-Up; Mon, 27 May 2024 14:35:01 -0400 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 1sBfBR-0007We-Rl for guix-patches@gnu.org; Mon, 27 May 2024 14:34:59 -0400 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 1sBfBQ-0001Ox-V7; Mon, 27 May 2024 14:34:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sBfBW-00012T-F1; Mon, 27 May 2024 14:35:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71232] [PATCH] gexp: Allow program-file to output unicode. Resent-From: Tomas Volf <~@wolfsden.cz> Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Mon, 27 May 2024 18:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71232 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71232@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , 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 , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.17168348513911 (code B ref -1); Mon, 27 May 2024 18:35:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 May 2024 18:34:11 +0000 Received: from localhost ([127.0.0.1]:45256 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sBfAg-000111-NK for submit@debbugs.gnu.org; Mon, 27 May 2024 14:34:10 -0400 Received: from lists.gnu.org ([209.51.188.17]:56580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <~@wolfsden.cz>) id 1sBfAd-00010t-Tv for submit@debbugs.gnu.org; Mon, 27 May 2024 14:34:08 -0400 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 <~@wolfsden.cz>) id 1sBfAU-0007Da-PR for guix-patches@gnu.org; Mon, 27 May 2024 14:33:58 -0400 Received: from wolfsden.cz ([37.205.8.62]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <~@wolfsden.cz>) id 1sBfAS-0001Jj-M2 for guix-patches@gnu.org; Mon, 27 May 2024 14:33:58 -0400 Received: by wolfsden.cz (Postfix, from userid 104) id 71BCC24999A; Mon, 27 May 2024 18:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1716834832; bh=ydOUH36DTg9lszoyy5x+Pn+YIsy7rahXPW/SnZ2Zufw=; h=From:To:Cc:Subject:Date; b=dIi1yljZDyYPnqq8XkDY/i3g8LnAORaPM6zw7wafWK3u+G8k8LJ+efQDJex2zdAeS TRKmsqBYZp/2M5c9d44rSdcwKBEikSp6PV7uUR5VuLZ3VZJlTp3BxEiax+L3eXcClW O/Mpe2qrPDjhv1HAzvfUznnIRvVA0TnGZSHjn2L5ltVSf3ae3SFaWDHwe9rqJ8WfAC BB4XO24ACFSkG5evUmnQBguBO6vT/JIIr//OmK8Q4i4KWuMhIY5hSQM9CeslmFLz88 gKrg3cE2TQ896vAeDzsLjyRXdQhz/bBAvOWqaKcM0ZDPzSQIZEN8Y+znDcFAQdJbKz 8Bc3jMvKLz+J1FrGSHxtL7/zywI0vVudKVdEJCKBhO6s9rMFBDxVfW6dmyayHk+OGC 0V+4aM76w8L7ic+tvXP5izyulQNpQNUIVCf1xG5i/DTB3bZWD6CK+KFU+pEOvnPSg7 RbsBEKWHukuUVvf0BBG2mZT9X5K3hCryRhcbqCBkQEMXakqO3TuTBVQmiHGMrHvETb bpCHRQv/OsrjfB4TZH3h3Lz5+3DFtduUK+oevPefq6L8TCt7uctzCw6OZEQqpHYNEb QdVfCC/5Ed+lzF2Bi7xtmReKMS0uPKu0TAmFNikQXWtbcyKh2YRL65FjQFfl99h2at APMVgIgSilCVY87KeP6V2fHM= Received: from localhost (unknown [193.32.127.155]) by wolfsden.cz (Postfix) with ESMTPSA id 82410249495; Mon, 27 May 2024 18:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=wolfsden.cz; s=mail; t=1716834831; bh=ydOUH36DTg9lszoyy5x+Pn+YIsy7rahXPW/SnZ2Zufw=; h=From:To:Cc:Subject:Date; b=LedU/KSvgnW8ZQFUZTXjUiXzHnBFlNik7LUSsjUoM3RtmoglMKc4Y8NDSiBKSiHbY UZPcYgDmYNgJPuFJKjaMBMCvohgu+SdsrGHC/AIc84DtMI9Sm3imN9niSwcQjjQEZi 2+pEs9rNBF/xCzumtUfaak59YoMqndjBFWUiEXyjBUXb0qYILwygEcQE6SYayuJUK4 IUDMq/6wyGNb867LcOURx+YwibFWzsvni/CrrIw9S7sMhiKAO5YeumL/ter0665dXn bkim7e5+EE2+rqWX0++8uv0hk7Z6Gd/2XOooXw1KhAfBTw1qiH0Qja+OShfVJKdxYE pyh8QfF1+oy979isiI1r9Sn1BJIz/2S9CKEGvxDesi98JJHuq5rCb5jRr0O3N2n3Hh 4Qj09c1wF8mSzN0okBX+scHER0x+Aj9sATk1/epHgXRzlyRLm9qvpxV+I3IUiiuXJY jTADkuhppjGvnNyHKIeWMqEMDaTLk+fOJQObj10z0OV1regd6xsBM1rzeApSJdWV/Q ibx5ru41VNXW04WCLtoXT8zN0SWIwYAebBHhLIc4HjnUs1CooigF4xdrpEZc2WeT30 iPTPb5QiySTYGWGkZQ+AR88STctFfjzR2AgQ2QcY5v4qeFEPaE5J8l8UmQjYDI1136 XvtlMYXeahbXi1hXqwXTXDM0= From: Tomas Volf <~@wolfsden.cz> Date: Mon, 27 May 2024 20:30:25 +0200 Message-ID: X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=37.205.8.62; envelope-from=~@wolfsden.cz; helo=wolfsden.cz X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches Due to the port being in ANSI_X3.4-1968 by default, λ character in the gexp is replaced by ?. Therefore #~((λ _ #t)) builds as ((? _ #t)), which does not work (obviously). The solution is to set the output port to UTF-8 encoding. That allows (program-file "utf8" #~((λ _ (display "猫\n")))) to build as #!... !# ((λ _ (display "猫\n"))) which does what you would expect. Change-Id: Ib96f5eed7fe0acfe23db09260a93a09bd6969024 --- Tested locally. No tests are provided, since whole tests/gexp.scm uses %bootstrap-guile (so version 2), where it worked already. It is problem only with more modern guile 3, which is used by actual builds. I am not sure how much this will rebuild and do not know how to find out. guix/gexp.scm | 1 + 1 file changed, 1 insertion(+) -- 2.41.0 diff --git a/guix/gexp.scm b/guix/gexp.scm index 74b4c49f90..23b7e4eae6 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -1997,6 +1997,7 @@ (define* (gexp->script name exp (gexp (call-with-output-file (ungexp output) (lambda (port) + (set-port-encoding! port "UTF-8") ;; Note: that makes a long shebang. When the store ;; is /gnu/store, that fits within the 128-byte ;; limit imposed by Linux, but that may go beyond