From 2e5c3d91fea5b583c541d70b4c318c2f81554d43 Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Thu, 3 Mar 2022 14:14:22 +0000 Subject: gexp: Correctly handle #$output in 'gexp->approximate-sexp'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This addresses the following backtrace from "guix lint -c wrapper-inputs hostapd": Backtrace:ostapd@2.10 [wrapper-inputs]... [...] 174:9 3 (gexp->approximate-sexp #) In srfi/srfi-1.scm: 586:17 2 (map1 (# #)) In guix/gexp.scm: 175:16 1 (_ _) In ice-9/boot-9.scm: 1685:16 0 (raise-exception _ #:continuable? _) ice-9/boot-9.scm:1685:16: In procedure raise-exception: Throw to key `match-error' with args `("match" "no matching pattern" #)'. * guix/gexp.scm (gexp->approximate-sexp): Handle the case where 'reference' is a ,, by returning (*approximate*). * tests/gexp.scm ("gexp->approximate-sexp, outputs"): Test it. Signed-off-by: Ludovic Courtès --- tests/gexp.scm | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/gexp.scm') diff --git a/tests/gexp.scm b/tests/gexp.scm index 61ed5bc02d..c80ca13fab 100644 --- a/tests/gexp.scm +++ b/tests/gexp.scm @@ -148,6 +148,11 @@ (define defmod 'define-module) ;fool Geiser (null? (gexp-inputs exp)) (gexp->sexp* exp)))) +(test-equal "gexp->approximate-sexp, outputs" + '(list 'out:foo (*approximate*) 'out:bar (*approximate*)) + (gexp->approximate-sexp + #~(list 'out:foo #$output:foo 'out:bar #$output:bar))) + (test-equal "unquote" '(display `(foo ,(+ 2 3))) (let ((exp (gexp (display `(foo ,(+ 2 3)))))) -- cgit v1.2.3