guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

03/04: gexp: Correctly handle #$output in 'gexp->approximate-sexp'.


From: guix-commits
Subject: 03/04: gexp: Correctly handle #$output in 'gexp->approximate-sexp'.
Date: Sun, 13 Mar 2022 18:28:45 -0400 (EDT)

civodul pushed a commit to branch master
in repository guix.

commit 2e5c3d91fea5b583c541d70b4c318c2f81554d43
Author: Maxime Devos <maximedevos@telenet.be>
AuthorDate: Thu Mar 3 14:14:22 2022 +0000

    gexp: Correctly handle #$output in 'gexp->approximate-sexp'.
    
    This addresses the following backtrace from
    "guix lint -c wrapper-inputs hostapd":
    
    Backtrace:ostapd@2.10 [wrapper-inputs]...
    [...]
        174:9  3 (gexp->approximate-sexp #<gexp (modify-phases %standard?>)
    In srfi/srfi-1.scm:
       586:17  2 (map1 (#<gexp-output out> #<gexp-input "pkg-config":o?>))
    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" 
#<gexp-output out>)'.
    
    * guix/gexp.scm (gexp->approximate-sexp): Handle the case where 'reference' 
is
      a <gexp-output>,, by returning (*approximate*).
    * tests/gexp.scm ("gexp->approximate-sexp, outputs"): Test it.
    
    Signed-off-by: Ludovic Courtès <ludo@gnu.org>
---
 guix/gexp.scm  | 3 ++-
 tests/gexp.scm | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/guix/gexp.scm b/guix/gexp.scm
index 38114f8863..9fdb7a30be 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -181,7 +181,8 @@ As a result, the S-expression will be approximate if GEXP 
has references."
                          (#true
                           ;; Simply returning 'thing' won't work in some
                           ;; situations; see 'write-gexp' below.
-                          '(*approximate*))))))
+                          '(*approximate*))))
+                  (($ <gexp-output>) '(*approximate*))))
               (gexp-references gexp))))
 
 (define (write-gexp gexp port)
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 @@
          (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))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]