summaryrefslogtreecommitdiff
path: root/guix
diff options
context:
space:
mode:
authorMaxime Devos <maximedevos@telenet.be>2022-03-03 13:57:03 +0000
committerLudovic Courtès <ludo@gnu.org>2022-03-13 23:18:14 +0100
commit5aec62ee0f69d691c1c1e322029463beb8bfc3cd (patch)
treefa2fa53cac8d5274ac0699b0628186e7e9c67392 /guix
parentfce9f13b5417b63a6ba5ae03bd8a2ae82ef0a043 (diff)
gexp: Correctly handle unquoting S-exp objects.
This fixes a false-positive in the linter: guix lint -c 'wrapper-inputs' libaio * guix/gexp.scm (gexp->approximate-sexp): Allow the 'thing' in <gexp-input> to be a sexp, without approximation, by testing if it is a record. * tests/gexp.scm ("unquoted sexp (not a gexp!)"): Test it. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix')
-rw-r--r--guix/gexp.scm16
1 files changed, 9 insertions, 7 deletions
diff --git a/guix/gexp.scm b/guix/gexp.scm
index e229c1fc8f..38114f8863 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -4,7 +4,7 @@
;;; Copyright © 2018 Jan Nieuwenhuizen <janneke@gnu.org>
;;; Copyright © 2019, 2020 Mathieu Othacehe <m.othacehe@gmail.com>
;;; Copyright © 2020 Maxim Cournoyer <maxim.cournoyer@gmail.com>
-;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2021, 2022 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -174,12 +174,14 @@ As a result, the S-expression will be approximate if GEXP has references."
(map (lambda (reference)
(match reference
(($ <gexp-input> thing output native)
- (if (gexp-like? thing)
- (gexp->approximate-sexp thing)
- ;; Simply returning 'thing' won't work in some
- ;; situations; see 'write-gexp' below.
- '(*approximate*)))
- (_ '(*approximate*))))
+ (cond ((gexp-like? thing)
+ (gexp->approximate-sexp thing))
+ ((not (record? thing)) ; a S-exp
+ thing)
+ (#true
+ ;; Simply returning 'thing' won't work in some
+ ;; situations; see 'write-gexp' below.
+ '(*approximate*))))))
(gexp-references gexp))))
(define (write-gexp gexp port)