From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id EFr4M69PB2PIJgEAbAwnHQ (envelope-from ) for ; Thu, 25 Aug 2022 12:32:15 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 0FW1M69PB2OE7wAAauVa8A (envelope-from ) for ; Thu, 25 Aug 2022 12:32:15 +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 35C56204C8 for ; Thu, 25 Aug 2022 12:32:15 +0200 (CEST) Received: from localhost ([::1]:45842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oRA9m-0006RU-7u for larch@yhetil.org; Thu, 25 Aug 2022 06:32:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45912) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oRA9b-0006RL-2G for guix-patches@gnu.org; Thu, 25 Aug 2022 06:32:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59335) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oRA9a-00029V-Ka for guix-patches@gnu.org; Thu, 25 Aug 2022 06:32:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oRA9a-0007Rs-Gg for guix-patches@gnu.org; Thu, 25 Aug 2022 06:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57050] [PATCH v3 07/14] gnu: Add Zuo. Resent-From: Efraim Flashner Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Aug 2022 10:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57050 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Philip McGrath Cc: Thiago Jung Bauermann , "\(" , Maxime Devos , Liliana Marie Prikler , Liliana Marie Prikler , 57050@debbugs.gnu.org Received: via spool by 57050-submit@debbugs.gnu.org id=B57050.166142349128592 (code B ref 57050); Thu, 25 Aug 2022 10:32:02 +0000 Received: (at 57050) by debbugs.gnu.org; 25 Aug 2022 10:31:31 +0000 Received: from localhost ([127.0.0.1]:49084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRA94-0007R5-6O for submit@debbugs.gnu.org; Thu, 25 Aug 2022 06:31:31 -0400 Received: from flashner.co.il ([178.62.234.194]:50608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oRA8z-0007Qo-2d for 57050@debbugs.gnu.org; Thu, 25 Aug 2022 06:31:28 -0400 Received: from localhost (unknown [31.210.177.64]) by flashner.co.il (Postfix) with ESMTPSA id A567C40204; Thu, 25 Aug 2022 10:31:18 +0000 (UTC) Date: Thu, 25 Aug 2022 13:30:45 +0300 From: Efraim Flashner Message-ID: Mail-Followup-To: Efraim Flashner , Philip McGrath , 57050@debbugs.gnu.org, Thiago Jung Bauermann , Liliana Marie Prikler , Liliana Marie Prikler , Maxime Devos , "(" References: <3231fd55699bd60448e5aaa3ca8ddf9fbea085c6.1661416343.git.philip@philipmcgrath.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="fZmL0MsKYgSBV6nf" Content-Disposition: inline In-Reply-To: <3231fd55699bd60448e5aaa3ca8ddf9fbea085c6.1661416343.git.philip@philipmcgrath.com> X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 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" 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=1661423535; 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: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; bh=vIUpliiBqvY9wDzjDXjQapYliypCQ0QA8i8cNaGkKxc=; b=N9b3mnkD553a7KTcjWtSpVGHfxbmc8OjQS6/UZjSA1GlD5twT/0SUSALY8Q524G4BubORY 8exB0cnW9PC67+D92fhG0gWhltFCLoNvnsrCbSswinPVgTmTiymxXGHNGHpuA84Z0g6Y84 DegY77gLSG/V+t9kLemvYDcd7baN+828kKPd9TN2rfwTGESlAI7b2nE7fYcIofKnKALvEU 8hQs4pwVOqfHTxnBae3AJRmFaKBUyfx2fDColiruhaCTDMG/xaHeROmF1GMNgoNu7P6j5o g6OUM4qkafOutnpL+7W5N7Fl91FnnSqCfRGQO6MM/L0UXN6hPKMk8WST87OAKg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661423535; a=rsa-sha256; cv=none; b=lyJa2MwLDcG99Lt1CXBCh6V4mTbu3cWpROiXdtG3m66JINr/K5T6j2v607/0Va1NiK/VJA do/VjRKhkQWW0O3l94lzLgsV3SkbqwqSV0CatZu2Fl7yG1H7V1w/rQNkAPb2a8gZ/by829 uphmOKivnglbFxeil4g1vSnh67kZR/S6Ex3XtjSjC2thL+0DxOy+7JK4Uvq43d5d6EZWLz h7wEiF/hTVgivwYJ+zuiODvhdJxwDwnMZYLApSnI+UdcaRKQimb6sOCtvFoPV6FGlEs1Db BopiCmjypPyb2x47vAzp2Pv1/SEZQSHaoXXD9ZDr6QxMMgPpn1ycPoogkMQr0w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; 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" X-Migadu-Spam-Score: -3.41 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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" X-Migadu-Queue-Id: 35C56204C8 X-Spam-Score: -3.41 X-Migadu-Scanner: scn0.migadu.com X-TUID: tfAI7uiix/cA --fZmL0MsKYgSBV6nf Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Aug 25, 2022 at 04:54:09AM -0400, Philip McGrath wrote: > * gnu/packages/patches/racket-backport-8.6-zuo.patch, > gnu/packages/patches/racket-zuo-bin-sh.patch: New patches. > * gnu/local.mk (dist_patch_DATA): Add them. > * gnu/packages/racket.scm (%zuo-version): New variable. > (zuo): New variable. > --- > gnu/local.mk | 2 + > .../patches/racket-backport-8.6-zuo.patch | 481 ++++++++++++++++++ > gnu/packages/patches/racket-zuo-bin-sh.patch | 74 +++ > gnu/packages/racket.scm | 51 ++ > 4 files changed, 608 insertions(+) > create mode 100644 gnu/packages/patches/racket-backport-8.6-zuo.patch > create mode 100644 gnu/packages/patches/racket-zuo-bin-sh.patch >=20 > diff --git a/gnu/local.mk b/gnu/local.mk > index babd54c8c6..c9c3061b33 100644 > --- a/gnu/local.mk > +++ b/gnu/local.mk > @@ -1769,8 +1769,10 @@ dist_patch_DATA =3D \ > %D%/packages/patches/ripperx-missing-file.patch \ > %D%/packages/patches/rpcbind-CVE-2017-8779.patch \ > %D%/packages/patches/rtags-separate-rct.patch \ > + %D%/packages/patches/racket-backport-8.6-zuo.patch \ > %D%/packages/patches/racket-chez-scheme-bin-sh.patch \ > %D%/packages/patches/racket-rktio-bin-sh.patch \ > + %D%/packages/patches/racket-zuo-bin-sh.patch \ > %D%/packages/patches/remake-impure-dirs.patch \ > %D%/packages/patches/restic-0.9.6-fix-tests-for-go1.15.patch \ > %D%/packages/patches/retroarch-LIBRETRO_DIRECTORY.patch \ > diff --git a/gnu/packages/patches/racket-backport-8.6-zuo.patch b/gnu/pac= kages/patches/racket-backport-8.6-zuo.patch > new file mode 100644 > index 0000000000..b86679b7ec > --- /dev/null > +++ b/gnu/packages/patches/racket-backport-8.6-zuo.patch > @@ -0,0 +1,481 @@ > +From 8761fc06b188b9ca2f4b7f2b7d1235075c44a321 Mon Sep 17 00:00:00 2001 > +From: Matthew Flatt > +Date: Sat, 23 Jul 2022 17:10:58 -0600 > +Subject: [PATCH 1/4] Zuo: support cross compilation via `configure` and > + `CC_FOR_BUILD` > + > +(cherry picked from commit 798a989ba6d1a30c491a3120b2c2f1570ecab911) > +--- > + racket/src/zuo/Makefile.in | 7 ++++++- > + racket/src/zuo/README.md | 10 ++++++++++ > + racket/src/zuo/configure | 15 +++++++++++++++ > + racket/src/zuo/configure.ac | 11 +++++++++++ > + 4 files changed, 42 insertions(+), 1 deletion(-) > + > +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in > +index 5d16e145bf..747b584c5c 100644 > +--- a/racket/src/zuo/Makefile.in > ++++ b/racket/src/zuo/Makefile.in > +@@ -17,6 +17,11 @@ CPPFLAGS =3D @CPPFLAGS@ > + LDFLAGS =3D @LDFLAGS@ > + LIBS =3D @LIBS@ > +=20 > ++CC_FOR_BUILD =3D @CC_FOR_BUILD@ > ++CFLAGS_FOR_BUILD =3D @CFLAGS_FOR_BUILD@ > ++LDFLAGS_FOR_BUILD =3D @LDFLAGS_FOR_BUILD@ > ++LIBS_FOR_BUILD =3D @LIBS_FOR_BUILD@ > ++ > + EMBED_LIBS =3D @EMBED_LIBS@ > +=20 > + .PHONY: zuos-to-run-and-install > +@@ -24,7 +29,7 @@ zuos-to-run-and-install: zuo > + ./zuo . zuos-to-run-and-install > +=20 > + zuo: $(srcdir)/zuo.c > +- $(CC) $(CPPFLAGS) $(CFLAGS) -DZUO_LIB_PATH=3D'"'"$(srcdir)/lib"'"' -o = zuo $(srcdir)/zuo.c $(LDFLAGS) $(LIBS) > ++ $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH=3D'"'"$(srcdir)/lib"= '"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) > +=20 > + .PHONY: check > + check: zuo > +diff --git a/racket/src/zuo/README.md b/racket/src/zuo/README.md > +index 17c88ee9ec..3aad504b7e 100644 > +--- a/racket/src/zuo/README.md > ++++ b/racket/src/zuo/README.md > +@@ -84,6 +84,16 @@ A boot image is machine-independent, whether in a sta= nd-alone file or > + embedded in `.c` source. > +=20 > +=20 > ++Cross Compiling > ++--------------- > ++ > ++If you use `./configure --host=3D...` to cross compile, then you will > ++also need to add something like `CC_FOR_BUILD=3Dcc` as a `./configure` > ++argument to specify the compiler for a `zuo` to use on the build > ++machine. If necessary, you can also specify `CFLAGS_FOR_BUILD`, > ++`LDFLAGS_FOR_BUILD`, and/or `LIBS_FOR_BUILD`. > ++ > ++ > + Embedding Zuo in Another Application > + ------------------------------------ > +=20 > +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure > +index 1fa34a3fe8..575ce07d96 100755 > +--- a/racket/src/zuo/configure > ++++ b/racket/src/zuo/configure > +@@ -589,6 +589,10 @@ enable_embed=3D"zuo" > + ac_subst_vars=3D'LTLIBOBJS > + LIBOBJS > + EMBED_LIBS > ++LIBS_FOR_BUILD > ++LDFLAGS_FOR_BUILD > ++CFLAGS_FOR_BUILD > ++CC_FOR_BUILD > + OBJEXT > + EXEEXT > + ac_ct_CC > +@@ -2584,6 +2588,17 @@ ac_link=3D'$CC -o conftest$ac_exeext $CFLAGS $CPP= FLAGS $LDFLAGS conftest.$ac_ext $ > + ac_compiler_gnu=3D$ac_cv_c_compiler_gnu > +=20 > +=20 > ++if test "${CC_FOR_BUILD}" =3D ""; then > ++ CC_FOR_BUILD=3D'$(CC) -O2' > ++ CFLAGS_FOR_BUILD=3D'$(CPPFLAGS) $(CFLAGS)' > ++ LDFLAGS_FOR_BUILD=3D'$(LDFLAGS)' > ++ LIBS_FOR_BUILD=3D'$(LIBS)' > ++fi > ++ > ++ > ++ > ++ > ++ > +=20 > + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EM= BED_LIBS}\"" >&5 > + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;} > +diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac > +index 89b3c6391d..598ff79629 100644 > +--- a/racket/src/zuo/configure.ac > ++++ b/racket/src/zuo/configure.ac > +@@ -25,6 +25,17 @@ AS_IF([test "x$enable_embed" =3D xno], > + AC_PROG_MAKE_SET() > + AC_PROG_CC > +=20 > ++if test "${CC_FOR_BUILD}" =3D ""; then > ++ CC_FOR_BUILD=3D'$(CC) -O2' > ++ CFLAGS_FOR_BUILD=3D'$(CPPFLAGS) $(CFLAGS)' > ++ LDFLAGS_FOR_BUILD=3D'$(LDFLAGS)' > ++ LIBS_FOR_BUILD=3D'$(LIBS)' > ++fi > ++AC_SUBST(CC_FOR_BUILD) > ++AC_SUBST(CFLAGS_FOR_BUILD) > ++AC_SUBST(LDFLAGS_FOR_BUILD) > ++AC_SUBST(LIBS_FOR_BUILD) > ++ > + AC_SUBST(EMBED_LIBS) > + AC_MSG_NOTICE([zuo libraries to embed: "${EMBED_LIBS}"]) > +=20 > +--=20 > +2.32.0 > + > + > +From f65194ea41eb472fbdd45d5f6c13eabe5e681704 Mon Sep 17 00:00:00 2001 > +From: Matthew Flatt > +Date: Sat, 23 Jul 2022 17:47:03 -0600 > +Subject: [PATCH 2/4] Zuo: sort hash keys > + > +Printing in a sorted order is helpful to make things more > +deterministic independent of symbol inputs. Making `hash-keys` > +produce a sorted list generalizes that determinism. > + > +(cherry picked from commit 4e7ffd3b365d01c5d0993c0b3fd24c9623962edf) > +--- > + racket/src/zuo/build.zuo | 5 ++- > + racket/src/zuo/tests/hash.zuo | 8 ++-- > + racket/src/zuo/zuo-doc/lang-zuo.scrbl | 18 +++++++-- > + racket/src/zuo/zuo.c | 57 ++++++++++++++++++++++++++- > + 4 files changed, 78 insertions(+), 10 deletions(-) > + > +diff --git a/racket/src/zuo/build.zuo b/racket/src/zuo/build.zuo > +index c1b5e8ce66..129240120a 100644 > +--- a/racket/src/zuo/build.zuo > ++++ b/racket/src/zuo/build.zuo > +@@ -47,7 +47,10 @@ > + (target (at-dir (add-exe name)) > + (lambda (path token) > + (rule (list image_zuo.c > +- (input-data-target 'config config) > ++ (input-data-target 'config (cons > ++ lib-path > ++ (map (lambda (key= ) (hash-ref config key)) > ++ '(CC CPPFLAG= S CFLAGS LDFLAGS LIBS)))) > + (quote-module-path)) > + (lambda () > + (define l (split-path path)) > +diff --git a/racket/src/zuo/tests/hash.zuo b/racket/src/zuo/tests/hash.z= uo > +index a35741c730..0d3d7f3af6 100644 > +--- a/racket/src/zuo/tests/hash.zuo > ++++ b/racket/src/zuo/tests/hash.zuo > +@@ -35,9 +35,7 @@ > +=20 > + (check (hash-keys (hash)) '()) > + (check (hash-keys (hash 'a 1)) '(a)) > +-(check (let ([keys (hash-keys (hash 'a 1 'b 2))]) > +- (or (equal? keys '(a b)) > +- (equal? keys '(b a))))) > ++(check (hash-keys (hash 'a 1 'b 2)) '(a b)) ; always in order > + (check (length (hash-keys (hash 'a 1 'b 2 'c 3))) 3) > + (check (length (hash-keys (hash 'a 1 'b 2 'a 3))) 2) > + (check-arg-fail (hash-keys 0) "not a hash table") > +@@ -50,3 +48,7 @@ > + (check (hash-keys-subset? (hash 'a 1 'b 2) (hash 'b 1)) #f) > + (check-arg-fail (hash-keys-subset? 0 (hash)) "not a hash table") > + (check-arg-fail (hash-keys-subset? (hash) 0) "not a hash table") > ++ > ++;; print sorts keys alphabetically: > ++(check (~a (hash 'a 1 'b 2)) "#hash((a . 1) (b . 2))") > ++(check (~a (hash 'b 2 'a 1)) "#hash((a . 1) (b . 2))") > +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-= doc/lang-zuo.scrbl > +index 94641d041e..4605e47471 100644 > +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl > ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl > +@@ -538,10 +538,20 @@ support to convert the textual form back into a ha= sh table value. > +=20 > + Analogous to @realracket*[hash? hash hash-ref hash-set hash-remove > + hash-keys hash-count hash-keys-subset?] from @racketmodname[racket]. > +-Besides being constrained to symbol keys, there is one additional > +-difference: the third argument to @racket[hash-ref], when supplied, > +-is always used as a value to return if a key is missing, as > +-opposed to a failure thunk.} > ++ > ++Besides being constrained to symbol keys, there are two additional > ++differences: > ++ > ++@itemlist[ > ++ > ++ @item{the third argument to @racket[hash-ref], when supplied, is > ++ always used as a value to return if a key is missing, as > ++ opposed to a failure thunk; and} > ++ > ++ @item{the @racket[hash-keys] function returns interned keys sorted > ++ alphabetically.} > ++ > ++]} > +=20 > +=20 > + @section{Procedures} > +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c > +index 2957d478af..88d5747326 100644 > +--- a/racket/src/zuo/zuo.c > ++++ b/racket/src/zuo/zuo.c > +@@ -1298,6 +1298,59 @@ static zuo_t *zuo_trie_keys(zuo_t *trie_in, zuo_t= *accum) { > + return accum; > + } > +=20 > ++/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ > ++/* symbol-list sorting = */ > ++/*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ > ++ > ++/* merge sort used to make hash printing deterministic */ > ++static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) { > ++ zuo_t *l, *left, *right, *first, *last; > ++ zuo_uint_t len =3D 0, i; > ++ > ++ for (l =3D l_in, len =3D 0; l !=3D z.o_null; l =3D _zuo_cdr(l)) > ++ len++; > ++ > ++ if (len < 2) > ++ return l_in; > ++ > ++ left =3D z.o_null; > ++ for (l =3D l_in, i =3D len >> 1; i > 0; l =3D _zuo_cdr(l), i--) > ++ left =3D zuo_cons(_zuo_car(l), left); > ++ right =3D l; > ++ > ++ left =3D zuo_symbol_list_sort(left); > ++ right =3D zuo_symbol_list_sort(right); > ++ > ++ first =3D last =3D z.o_null; > ++ while ((left !=3D z.o_null) && (right !=3D z.o_null)) { > ++ zuo_t *p; > ++ > ++ if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str), > ++ ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str)) > ++ < 1) { > ++ p =3D zuo_cons(_zuo_car(left), z.o_null); > ++ left =3D _zuo_cdr(left); > ++ } else { > ++ p =3D zuo_cons(_zuo_car(right), z.o_null); > ++ right =3D _zuo_cdr(right); > ++ } > ++ > ++ if (first =3D=3D z.o_null) > ++ first =3D p; > ++ else > ++ ((zuo_pair_t *)last)->cdr =3D p; > ++ last =3D p; > ++ } > ++ > ++ ((zuo_pair_t *)last)->cdr =3D ((left !=3D z.o_null) ? left : right); > ++ > ++ return first; > ++} > ++ > ++static zuo_t *zuo_trie_sorted_keys(zuo_t *trie_in, zuo_t *accum) { > ++ return zuo_symbol_list_sort(zuo_trie_keys(trie_in, accum)); > ++} > ++ > + /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ > + /* terminal support = */ > + /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/ > +@@ -1571,7 +1624,7 @@ static void zuo_out(zuo_out_t *out, zuo_t *obj, zu= o_print_mode_t mode) { > + out_string(out, "opaque"); > + out_string(out, ">"); > + } else if (obj->tag =3D=3D zuo_trie_node_tag) { > +- zuo_t *keys =3D zuo_trie_keys(obj, z.o_null); > ++ zuo_t *keys =3D zuo_trie_sorted_keys(obj, z.o_null); > + if (mode =3D=3D zuo_print_mode) { > + out_string(out, "(hash"); > + if (keys !=3D z.o_null) > +@@ -2587,7 +2640,7 @@ static zuo_t *zuo_hash_remove(zuo_t *ht, zuo_t *sy= m) { > +=20 > + static zuo_t *zuo_hash_keys(zuo_t *ht) { > + check_hash("hash-keys", ht); > +- return zuo_trie_keys(ht, z.o_null); > ++ return zuo_trie_sorted_keys(ht, z.o_null); > + } > +=20 > + static zuo_t *zuo_hash_keys_subset_p(zuo_t *ht, zuo_t *ht2) { > +--=20 > +2.32.0 > + > + > +From f2eecaa1dd875479d2cf51566223b3d0d7b9f738 Mon Sep 17 00:00:00 2001 > +From: Matthew Flatt > +Date: Sat, 23 Jul 2022 18:06:41 -0600 > +Subject: [PATCH 3/4] Zuo: check for nul characters in `string->symbol` > + > +(cherry picked from commit e20022ccfad40d0ba2e77aa75bc4f775018c781f) > +--- > + racket/src/zuo/tests/symbol.zuo | 3 +++ > + racket/src/zuo/zuo-doc/lang-zuo.scrbl | 4 ++- > + racket/src/zuo/zuo.c | 37 +++++++++++++++++---------- > + 3 files changed, 29 insertions(+), 15 deletions(-) > + > +diff --git a/racket/src/zuo/tests/symbol.zuo b/racket/src/zuo/tests/symb= ol.zuo > +index 7775aeeb04..5600a89755 100644 > +--- a/racket/src/zuo/tests/symbol.zuo > ++++ b/racket/src/zuo/tests/symbol.zuo > +@@ -19,3 +19,6 @@ > + (check (not (equal? 'apple (string->uninterned-symbol "apple")))) > + (check-arg-fail (string->symbol 'apple) not-string) > + (check-arg-fail (string->uninterned-symbol 'apple) not-string) > ++ > ++(check-arg-fail (string->symbol "apple\0spice") "without a nul characte= r") > ++(check (symbol? (string->uninterned-symbol "apple\0spice"))) > +diff --git a/racket/src/zuo/zuo-doc/lang-zuo.scrbl b/racket/src/zuo/zuo-= doc/lang-zuo.scrbl > +index 4605e47471..07dd5815b0 100644 > +--- a/racket/src/zuo/zuo-doc/lang-zuo.scrbl > ++++ b/racket/src/zuo/zuo-doc/lang-zuo.scrbl > +@@ -500,7 +500,9 @@ back into Zuo. > + )]{ > +=20 > + Analogous to @realracket*[symbol? symbol->string string->symbol > +-string->uninterned-symbol] from @racketmodname[racket].} > ++string->uninterned-symbol] from @racketmodname[racket], but > ++@racket[string->symbol] accepts only strings that do not contain the > ++null character.} > +=20 > +=20 > + @section{Hash Tables (Persistent Maps)} > +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c > +index 88d5747326..17f161826d 100644 > +--- a/racket/src/zuo/zuo.c > ++++ b/racket/src/zuo/zuo.c > +@@ -1323,7 +1323,7 @@ static zuo_t *zuo_symbol_list_sort(zuo_t *l_in) { > +=20 > + first =3D last =3D z.o_null; > + while ((left !=3D z.o_null) && (right !=3D z.o_null)) { > +- zuo_t *p; > ++ zuo_t *p, *s_left, *s_right; > +=20 > + if (strcmp(ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(left))->str), > + ZUO_STRING_PTR(((zuo_symbol_t *)_zuo_car(right))->str)) > +@@ -2573,8 +2573,28 @@ static zuo_t *zuo_substring(zuo_t *obj, zuo_t *st= art_i, zuo_t *end_i) { > + return zuo_sized_string((const char *)&((zuo_string_t *)obj)->s[s_idx= ], e_idx - s_idx); > + } > +=20 > ++static int zuo_is_string_without_nul(zuo_t *obj) { > ++ zuo_int_t i; > ++ > ++ if ((obj->tag !=3D zuo_string_tag) > ++ || ZUO_STRING_LEN(obj) =3D=3D 0) > ++ return 0; > ++ > ++ for (i =3D ZUO_STRING_LEN(obj); i--; ) { > ++ if (((zuo_string_t *)obj)->s[i] =3D=3D 0) > ++ return 0; > ++ } > ++ > ++ return 1; > ++} > ++ > + static zuo_t *zuo_string_to_symbol(zuo_t *obj) { > +- check_string("string->symbol", obj); > ++ if (!zuo_is_string_without_nul(obj)) { > ++ const char *who =3D "string->symbol"; > ++ check_string(who, obj); > ++ zuo_fail_arg(who, "string without a nul character", obj); > ++ } > ++ > + return zuo_symbol_from_string(ZUO_STRING_PTR(obj), obj); > + } > +=20 > +@@ -3577,18 +3597,7 @@ static void *zuo_envvars_block(const char *who, z= uo_t *envvars) > + #endif > +=20 > + static int zuo_is_path_string(zuo_t *obj) { > +- zuo_int_t i; > +- > +- if ((obj->tag !=3D zuo_string_tag) > +- || ZUO_STRING_LEN(obj) =3D=3D 0) > +- return 0; > +- > +- for (i =3D ZUO_STRING_LEN(obj); i--; ) { > +- if (((zuo_string_t *)obj)->s[i] =3D=3D 0) > +- return 0; > +- } > +- > +- return 1; > ++ return zuo_is_string_without_nul(obj); > + } > +=20 > + static zuo_t *zuo_path_string_p(zuo_t *obj) { > +--=20 > +2.32.0 > + > + > +From de6618cb3819d25580e3cd400ea09c8cf4f673a9 Mon Sep 17 00:00:00 2001 > +From: Matthew Flatt > +Date: Sat, 23 Jul 2022 19:50:46 -0600 > +Subject: [PATCH 4/4] Zuo: CPPFLAGS_FOR_BUILD, too > + > +(cherry picked from commit cf82706c4b298f654a04c4bc8d98dff39b62a2ac) > +--- > + racket/src/zuo/Makefile.in | 3 ++- > + racket/src/zuo/configure | 5 ++++- > + racket/src/zuo/configure.ac | 4 +++- > + 3 files changed, 9 insertions(+), 3 deletions(-) > + > +diff --git a/racket/src/zuo/Makefile.in b/racket/src/zuo/Makefile.in > +index 747b584c5c..0376c038a8 100644 > +--- a/racket/src/zuo/Makefile.in > ++++ b/racket/src/zuo/Makefile.in > +@@ -19,6 +19,7 @@ LIBS =3D @LIBS@ > +=20 > + CC_FOR_BUILD =3D @CC_FOR_BUILD@ > + CFLAGS_FOR_BUILD =3D @CFLAGS_FOR_BUILD@ > ++CPPFLAGS_FOR_BUILD =3D @CPPFLAGS_FOR_BUILD@ > + LDFLAGS_FOR_BUILD =3D @LDFLAGS_FOR_BUILD@ > + LIBS_FOR_BUILD =3D @LIBS_FOR_BUILD@ > +=20 > +@@ -29,7 +30,7 @@ zuos-to-run-and-install: zuo > + ./zuo . zuos-to-run-and-install > +=20 > + zuo: $(srcdir)/zuo.c > +- $(CC_FOR_BUILD) $(FLAGS_FOR_BUILD) -DZUO_LIB_PATH=3D'"'"$(srcdir)/lib"= '"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LIBS_FOR_BUILD) > ++ $(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) -DZUO_LIB_PA= TH=3D'"'"$(srcdir)/lib"'"' -o zuo $(srcdir)/zuo.c $(LDFLAGS_FOR_BUILD) $(LI= BS_FOR_BUILD) > +=20 > + .PHONY: check > + check: zuo > +diff --git a/racket/src/zuo/configure b/racket/src/zuo/configure > +index 575ce07d96..7ac453e3bc 100755 > +--- a/racket/src/zuo/configure > ++++ b/racket/src/zuo/configure > +@@ -591,6 +591,7 @@ LIBOBJS > + EMBED_LIBS > + LIBS_FOR_BUILD > + LDFLAGS_FOR_BUILD > ++CPPFLAGS_FOR_BUILD > + CFLAGS_FOR_BUILD > + CC_FOR_BUILD > + OBJEXT > +@@ -2590,7 +2591,8 @@ ac_compiler_gnu=3D$ac_cv_c_compiler_gnu > +=20 > + if test "${CC_FOR_BUILD}" =3D ""; then > + CC_FOR_BUILD=3D'$(CC) -O2' > +- CFLAGS_FOR_BUILD=3D'$(CPPFLAGS) $(CFLAGS)' > ++ CPPFLAGS_FOR_BUILD=3D'$(CPPFLAGS)' > ++ CFLAGS_FOR_BUILD=3D'$(CFLAGS)' > + LDFLAGS_FOR_BUILD=3D'$(LDFLAGS)' > + LIBS_FOR_BUILD=3D'$(LIBS)' > + fi > +@@ -2600,6 +2602,7 @@ fi > +=20 > +=20 > +=20 > ++ > + { $as_echo "$as_me:${as_lineno-$LINENO}: zuo libraries to embed: \"${EM= BED_LIBS}\"" >&5 > + $as_echo "$as_me: zuo libraries to embed: \"${EMBED_LIBS}\"" >&6;} > +=20 > +diff --git a/racket/src/zuo/configure.ac b/racket/src/zuo/configure.ac > +index 598ff79629..051ea0beb5 100644 > +--- a/racket/src/zuo/configure.ac > ++++ b/racket/src/zuo/configure.ac > +@@ -27,12 +27,14 @@ AC_PROG_CC > +=20 > + if test "${CC_FOR_BUILD}" =3D ""; then > + CC_FOR_BUILD=3D'$(CC) -O2' > +- CFLAGS_FOR_BUILD=3D'$(CPPFLAGS) $(CFLAGS)' > ++ CPPFLAGS_FOR_BUILD=3D'$(CPPFLAGS)' > ++ CFLAGS_FOR_BUILD=3D'$(CFLAGS)' > + LDFLAGS_FOR_BUILD=3D'$(LDFLAGS)' > + LIBS_FOR_BUILD=3D'$(LIBS)' > + fi > + AC_SUBST(CC_FOR_BUILD) > + AC_SUBST(CFLAGS_FOR_BUILD) > ++AC_SUBST(CPPFLAGS_FOR_BUILD) > + AC_SUBST(LDFLAGS_FOR_BUILD) > + AC_SUBST(LIBS_FOR_BUILD) > +=20 > +--=20 > +2.32.0 > + > diff --git a/gnu/packages/patches/racket-zuo-bin-sh.patch b/gnu/packages/= patches/racket-zuo-bin-sh.patch > new file mode 100644 > index 0000000000..bcdcb8e963 > --- /dev/null > +++ b/gnu/packages/patches/racket-zuo-bin-sh.patch > @@ -0,0 +1,74 @@ > +From 73d9b77a11b4516905caf579abb559736f715ea6 Mon Sep 17 00:00:00 2001 > +From: Philip McGrath > +Date: Mon, 11 Apr 2022 20:43:18 -0400 > +Subject: [PATCH] Zuo: patch zuo_process for "/bin/sh" on Guix > + > +If: > + > + 1. The nonstandard but ubiquitous macro `_PATH_BSHELL` from > + is defined; and > + > + 2. `zuo_process` is called with the exact path "/bin/sh"; and > + > + 3. The path specified by `_PATH_BSHELL` exists; > + > +then `zuo_process` will execute the file specified by `_PATH_BSHELL` > +instead of "/bin/sh". > + > +Checking that the path specified by `_PATH_BSHELL` exists safeguards > +against obscure errors if attempting to use stand-alone executables > +built by the patched Racket in non-Guix envoronments. > +--- > + racket/src/zuo/zuo.c | 20 ++++++++++++++++++-- > + 1 file changed, 18 insertions(+), 2 deletions(-) > + > +diff --git a/racket/src/zuo/zuo.c b/racket/src/zuo/zuo.c > +index 17f161826d..c4fb3929bb 100644 > +--- a/racket/src/zuo/zuo.c > ++++ b/racket/src/zuo/zuo.c > +@@ -15,6 +15,7 @@ > + #include > + #include > + #ifdef ZUO_UNIX > ++# include /* PATCHED for Guix */ > + # include > + # include > + # include > +@@ -5730,7 +5731,10 @@ static void zuo_pipe(zuo_raw_handle_t *_r, zuo_ra= w_handle_t *_w) > + zuo_t *zuo_process(zuo_t *command_and_args) > + { > + const char *who =3D "process"; > +- zuo_t *command =3D _zuo_car(command_and_args); > ++ /* BEGIN PATCH for Guix */ > ++ zuo_t *_guix_orig_command =3D _zuo_car(command_and_args); > ++ zuo_t *command; > ++ /* END PATCH for Guix */ > + zuo_t *args =3D _zuo_cdr(command_and_args), *rev_args =3D z.o_null; > + zuo_t *options =3D z.o_empty_hash, *opt; > + zuo_t *dir, *l, *p_handle, *result; > +@@ -5741,7 +5745,19 @@ zuo_t *zuo_process(zuo_t *command_and_args) > + void *env; > + int as_child, exact_cmdline; > +=20 > +- check_path_string(who, command); > ++ /* BEGIN PATCH for Guix */ > ++ check_path_string(who, _guix_orig_command); > ++#if defined(_PATH_BSHELL) > ++ command =3D > ++ ((z.o_false =3D=3D zuo_string_eql(_guix_orig_command, zuo_string("/= bin/sh"))) > ++ || (z.o_false =3D=3D zuo_stat(zuo_string(_PATH_BSHELL), z.o_false,= z.o_true))) > ++ ? _guix_orig_command > ++ : zuo_string(_PATH_BSHELL); > ++#else > ++ command =3D _guix_orig_command; > ++#endif > ++ /* END PATCH for Guix */ > ++ > + for (l =3D args; l->tag =3D=3D zuo_pair_tag; l =3D _zuo_cdr(l)) { > + zuo_t *a =3D _zuo_car(l); > + if (a =3D=3D z.o_null) { > + > +base-commit: 87eee6e2adb8c6bc11e60619c706fa6295096085 > +--=20 > +2.32.0 > + > diff --git a/gnu/packages/racket.scm b/gnu/packages/racket.scm > index 0f766e7850..6433897981 100644 > --- a/gnu/packages/racket.scm > +++ b/gnu/packages/racket.scm > @@ -200,6 +200,7 @@ (define* (racket-vm-for-system #:optional > racket-vm-bc)) > =20 > (define %racket-version "8.5") ; Remember to update chez-scheme-for-rack= et! > +(define %zuo-version "1.0") ; defined in racket/src/zuo/zuo.c > (define %racket-commit > (string-append "v" %racket-version)) > (define %racket-origin > @@ -232,6 +233,56 @@ (define %racket-origin > ;; Unbundle libffi. > (delete-file-recursively "racket/src/bc/foreign/libffi"))))) > =20 > + > +(define-public zuo > + (let ((revision #f)) > + (package > + (name "zuo") > + (version (string-append %zuo-version > + "-racket" > + "8.6" Should the 8.6 instead be %racket-version? I understand above it is currently 8.5 but why is it hardcoded? I'm a little late to the party. > + (if revision "-guix" "") > + (or revision ""))) I'd rather this be (if revision (string-append "-guix" revision) "") > + (source > + (origin > + (inherit %racket-origin) > + (uri (git-reference > + (url "https://github.com/racket/racket") > + (commit "v8.6"))) > + (sha256 > + (base32 "1yi36nr7zrdwrnvpmliirxxjz4pyfyhkar6yvk3rapvmg4q2vmnk"= )) > + (patches (append (origin-patches %racket-origin) > + (search-patches "racket-backport-8.6-zuo.patch" > + "racket-zuo-bin-sh.patch"))) > + (file-name (git-file-name "racket" "8.6")))) I see a third instance of "8.6", lets factor this out either use %racket-version (I see we've decided on updating separately from racket, so that's out) or zuo-racket-version would also work, as a variable up with revision. > + (outputs '("out" "debug")) > + (build-system gnu-build-system) > + (arguments > + (list > + #:out-of-source? #t > + #:phases > + #~(modify-phases %standard-phases > + (add-after 'unpack 'chdir > + (lambda args > + (chdir "racket/src/zuo")))))) > + (home-page "https://github.com/racket/zuo") > + ;; ^ This is downstream of https://github.com/racket/racket, > + ;; but it's designed to be a friendly landing place > + (synopsis "Tiny Racket for build scripts") > + (description "You should use Racket to write scripts. But what if= you > +need something much smaller than Racket for some reason=E2=80=94or what = if you're > +trying to script a build of Racket itself? Zuo (=E4=BD=9C) is a tiny Ra= cket with > +primitives for dealing with files and running processes, and it comes wi= th a > +@command{make}-like embedded DSL. > + > +Zuo is a Racket variant in the sense that program files start with > +@code{#lang}, and the module path after @code{#lang} determines the pars= ing > +and expansion of the file content. That's how the @command{make}-like D= SL is > +defined, and even the base Zuo language is defined by layers of @code{#l= ang}s. > +One of the early layers implements macros.") > + (license (list license:asl2.0 license:expat))))) I'm not sold on the second paragraph, but I understand it's from upstream so that's not too bad. For the first paragraph I'd drop the first two sentences and consider @acronym{symbol, Zuo} for the next sentence. > + > + > (define racket-vm-common-configure-flags > #~`(,@(cond > ((false-if-exception > --=20 > 2.32.0 >=20 --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --fZmL0MsKYgSBV6nf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmMHT1MACgkQQarn3Mo9 g1GM+BAAlUy7u7/yc5/BA3wR8dbKn3hMCsbnlud/N4qpqHpTaimhQZkk4gk1U3b1 5hN5PT69SEsYtQjeZkAgHI/x2hR3wMOUT8CfqjNDlQiqfVNIBI0HCHBB6eqjgn99 baiIEThgQ0Jz+29l4xGAw7LeoQBdRx9pI3Jz3fT8EZfErfG2VbRaYXpxrb1nEwY7 kSxkuffrSuEt3blP1w0xcAwMpTE0ptIqN/PwaJLPHrh7ul+/VFfXJk/AXqCINDNL P40bg06UarmRdWamwyJNTIU9WJUq06mlkN9pBpjstApvYEtpOnbpka2qECLczxkk YZDyQzzAvas378BU8bUuOIdSwlo4qOGOUo4j7jYyn5DL6PqEyRIFL+OTMYGdFcQl ZtTD8OoE47v/Gxgrh1w9z3IQa7yz9I3AWGCZi10YIE/WaUJs6JEgdyvzOmvCNvpQ 8esO0kiQpjH1gx/PVIxqQpH3IHHCsw6ZwiuqY0BMtm3WpH21vYqraY5rW1/JorzN 2wcbf/1MwGcIc9n6awyzOVROz0/b8lgIWMG+zHBzKoQgXtIuAwCto6BhRS77xiOg BPokLVWFgPGGbRa3U+4ksRr01BuW1x/IBmtYa1XK3nadBH3430Svu1CEbsB/bTD8 c/oYoKLxr5um1JMpyoRbguCZGIVaOtYBbqXTVqM4SZg+O0jg9qc= =sTOb -----END PGP SIGNATURE----- --fZmL0MsKYgSBV6nf--