diff options
author | Ludovic Courtès <ludo@gnu.org> | 2020-10-01 22:09:58 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2020-10-02 08:11:38 +0200 |
commit | f43ffee90882c2d61b46d69728daa7432be297e4 (patch) | |
tree | 78616df51a7950f27f4918b8395b2d1019228aad /tests/guix-system.sh | |
parent | 23dc21f05b54ef63daaea9eb301cfddbc4c82ddb (diff) | |
download | guix-f43ffee90882c2d61b46d69728daa7432be297e4.tar.gz |
gexp: 'local-file' warns when passed a non-literal relative file name.
Fixes <https://bugs.gnu.org/43736>. Reported by Vitaliy Shatrov <guix.vits@disroot.org>. * guix/gexp.scm (%local-file): Add #:literal? and #:location. Emit a warning when LITERAL? is false and FILE is not absolute. (local-file): In the non-literal case, pass #:location and #:literal?. * po/guix/POTFILES.in: Add guix/gexp.scm. * tests/guix-system.sh: Add test for the warning.
Diffstat (limited to 'tests/guix-system.sh')
-rw-r--r-- | tests/guix-system.sh | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/guix-system.sh b/tests/guix-system.sh index 667e084fcf..957479ede0 100644 --- a/tests/guix-system.sh +++ b/tests/guix-system.sh @@ -297,6 +297,20 @@ EOF guix system build "$tmpdir/config.scm" -n (cd "$tmpdir"; guix system build "config.scm" -n) +# Check that we get a warning when passing 'local-file' a non-literal relative +# file name. +cat > "$tmpdir/config.scm" <<EOF +(use-modules (guix)) + +(define (bad-local-file file) + (local-file file)) + +(bad-local-file "whatever.scm") +EOF +! guix system build "$tmpdir/config.scm" -n +guix system build "$tmpdir/config.scm" -n 2>&1 | \ + grep "config\.scm:4:2: warning:.*whatever.*relative to current directory" + # Searching. guix system search tor | grep "^name: tor" guix system search tor | grep "^shepherdnames: tor" |