GNU bug report logs - #71232
[PATCH] gexp: Allow program-file to output unicode.

Previous Next

Package: guix-patches;

Reported by: Tomas Volf <~@wolfsden.cz>

Date: Mon, 27 May 2024 18:35:02 UTC

Severity: normal

Tags: patch

Done: Tomas Volf <~@wolfsden.cz>

To reply to this bug, email your comments to 71232 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org:
bug#71232; Package guix-patches. (Mon, 27 May 2024 18:35:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to guix <at> cbaines.net, dev <at> jpoiret.xyz, ludo <at> gnu.org, othacehe <at> gnu.org, rekado <at> elephly.net, zimon.toutoune <at> gmail.com, me <at> tobias.gr, guix-patches <at> gnu.org. (Mon, 27 May 2024 18:35:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tomas Volf <~@wolfsden.cz>
To: guix-patches <at> gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH] gexp: Allow program-file to output unicode.
Date: Mon, 27 May 2024 20:30:25 +0200
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(+)

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
--
2.41.0




bug closed, send any further explanations to 71232 <at> debbugs.gnu.org and Tomas Volf <~@wolfsden.cz> Request was from Tomas Volf <~@wolfsden.cz> to control <at> debbugs.gnu.org. (Sun, 06 Oct 2024 15:44:03 GMT) Full text and rfc822 format available.

This bug report was last modified 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.