From 5aec62ee0f69d691c1c1e322029463beb8bfc3cd Mon Sep 17 00:00:00 2001 From: Maxime Devos Date: Thu, 3 Mar 2022 13:57:03 +0000 Subject: gexp: Correctly handle unquoting S-exp objects. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes a false-positive in the linter: guix lint -c 'wrapper-inputs' libaio * guix/gexp.scm (gexp->approximate-sexp): Allow the 'thing' in 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 --- guix/gexp.scm | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'guix') 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 ;;; Copyright © 2019, 2020 Mathieu Othacehe ;;; Copyright © 2020 Maxim Cournoyer -;;; Copyright © 2021 Maxime Devos +;;; Copyright © 2021, 2022 Maxime Devos ;;; ;;; 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 (($ 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) -- cgit v1.2.3