[PATCH] gexp: Allow program-file to output unicode.

  • Open
  • quality assurance status badge
Details
One participant
  • Tomas Volf
Owner
unassigned
Submitted by
Tomas Volf
Severity
normal
T
T
Tomas Volf wrote on 27 May 20:30 +0200
(address . guix-patches@gnu.org)(name . Tomas Volf)(address . ~@wolfsden.cz)
f7a61ff72518ba5e594d7ab54fed3d8669d0e6d8.1716834624.git.~@wolfsden.cz
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(+)

Toggle diff (12 lines)
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
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 71232@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 71232
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch