1
0
mirror of https://git.savannah.gnu.org/git/guix.git synced 2026-04-06 21:20:33 +02:00

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>
This commit is contained in:
Maxime Devos
2022-03-03 13:57:03 +00:00
committed by Ludovic Courtès
parent fce9f13b54
commit 5aec62ee0f
2 changed files with 23 additions and 8 deletions

View File

@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014-2022 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2021-2022 Maxime Devos <maximedevos@telenet.be>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -121,6 +121,19 @@
(let ((inside (file-append coreutils "/bin/hello")))
(gexp->approximate-sexp #~(display '#$inside))))
;; See <https://issues.guix.gnu.org/54236>.
(test-equal "unquoted sexp (not a gexp!)"
'(list #(foo) (foo) () "foo" foo #xf00)
(let ((inside/vector #(foo))
(inside/list '(foo))
(inside/empty '())
(inside/string "foo")
(inside/symbol 'foo)
(inside/number #xf00))
(gexp->approximate-sexp
#~(list #$inside/vector #$inside/list #$inside/empty #$inside/string
#$inside/symbol #$inside/number))))
(test-equal "no refs"
'(display "hello!")
(let ((exp (gexp (display "hello!"))))