GNU bug report logs - #38628
Character literals unsupported in source 'snippets'

Previous Next

Package: guix;

Reported by: Marius Bakke <mbakke <at> fastmail.com>

Date: Sun, 15 Dec 2019 20:28:01 UTC

Severity: normal

Done: Marius Bakke <mbakke <at> fastmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38628 in the body.
You can then email your comments to 38628 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guix <at> gnu.org:
bug#38628; Package guix. (Sun, 15 Dec 2019 20:28:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Marius Bakke <mbakke <at> fastmail.com>:
New bug report received and forwarded. Copy sent to bug-guix <at> gnu.org. (Sun, 15 Dec 2019 20:28:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: bug-guix <at> gnu.org
Subject: Character literals unsupported in source 'snippets'
Date: Sun, 15 Dec 2019 21:27:08 +0100
[Message part 1 (text/plain, inline)]
Guix,

If you try to use a character literal in a source 'snippet', Guix will
complain about an "unsupported input".  I.e. adding the following to the
'hello' package definition:

              (snippet '(begin #\!))

Results in:

guix build: error: /home/marius/guix/gnu/packages/base.scm:73:2: package `hello <at> 2.10' has an invalid input: #\!

This is a fairly recent regression.  I tracked it down to the following commit:

commit 24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c
Author: Ludovic Courtès <ludo <at> gnu.org>
Date:   Mon Sep 23 22:17:39 2019 +0200

    gexp: Catch and report non-self-quoting gexp inputs.
    
    Previously we would, for example, generate build scripts in the store;
    when trying to run them, we'd get a 'read' error due to the presence
    of #<foo> syntax in there.
    
    * guix/gexp.scm (gexp->sexp)[self-quoting?]: New procedure.
    [reference->sexp]: Check whether the argument in a <gexp-input> box is
    self-quoting.  Raise a '&gexp-input-error' condition if it's not.
    * tests/gexp.scm ("lower-gexp, non-self-quoting input"): New test.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#38628; Package guix. (Sun, 15 Dec 2019 20:36:02 GMT) Full text and rfc822 format available.

Message #8 received at 38628 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: 38628 <at> debbugs.gnu.org
Subject: [PATCH] gexp: Allow character literals in GEXP->SEXP.
Date: Sun, 15 Dec 2019 21:35:13 +0100
Fixes <https://bugs.gnu.org/38628>

* guix/gexp.scm (gexp->sexp)[self-quoting?]: Add CHAR? to the tested types.
---
 guix/gexp.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/guix/gexp.scm b/guix/gexp.scm
index a96592ac76..411f0844ff 100644
--- a/guix/gexp.scm
+++ b/guix/gexp.scm
@@ -1028,7 +1028,7 @@ and in the current monad setting (system type, etc.)"
                                (or (pred x)
                                    (one-of rest ...))))))
       (one-of symbol? string? keyword? pair? null? array?
-              number? boolean?)))
+              number? boolean? char?)))
 
   (define* (reference->sexp ref #:optional native?)
     (with-monad %store-monad
-- 
2.24.0





Information forwarded to bug-guix <at> gnu.org:
bug#38628; Package guix. (Mon, 16 Dec 2019 21:52:01 GMT) Full text and rfc822 format available.

Message #11 received at 38628 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 38628 <at> debbugs.gnu.org
Subject: Re: bug#38628: [PATCH] gexp: Allow character literals in GEXP->SEXP.
Date: Mon, 16 Dec 2019 22:51:21 +0100
Hi!

Marius Bakke <mbakke <at> fastmail.com> skribis:

> Fixes <https://bugs.gnu.org/38628>
>
> * guix/gexp.scm (gexp->sexp)[self-quoting?]: Add CHAR? to the tested types.

Oops, good catch, LGTM!

Could you also fix the occurrences of the ‘one-of’ macro in (gnu tests)
and (guix repl)?

(I know, this shouldn’t be duplicated in the first place but (guix repl)
has to be self-contained…)

Thanks,
Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#38628; Package guix. (Mon, 16 Dec 2019 21:54:02 GMT) Full text and rfc822 format available.

Message #14 received at 38628 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 38628 <at> debbugs.gnu.org
Subject: Re: bug#38628: [PATCH] gexp: Allow character literals in GEXP->SEXP.
Date: Mon, 16 Dec 2019 22:53:10 +0100
Also it would be nice to add a tiny test close to the one that
24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c added.

Ludo’.




Information forwarded to bug-guix <at> gnu.org:
bug#38628; Package guix. (Wed, 18 Dec 2019 19:01:01 GMT) Full text and rfc822 format available.

Message #17 received at 38628 <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 38628 <at> debbugs.gnu.org
Subject: Re: bug#38628: [PATCH] gexp: Allow character literals in GEXP->SEXP.
Date: Wed, 18 Dec 2019 19:59:59 +0100
[Message part 1 (text/plain, inline)]
Ludovic Courtès <ludo <at> gnu.org> writes:

> Also it would be nice to add a tiny test close to the one that
> 24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c added.

Good idea.  I came up with this:

[Message part 2 (text/x-patch, inline)]
diff --git a/tests/gexp.scm b/tests/gexp.scm
index 84c16422c2..8b1596f66d 100644
--- a/tests/gexp.scm
+++ b/tests/gexp.scm
@@ -886,6 +886,12 @@
     (run-with-store %store
       (lower-gexp #~(foo #$+)))))
 
+(test-equal "lower-gexp, character literal"
+  '(#\+)
+  (lowered-gexp-sexp
+   (run-with-store %store
+     (lower-gexp #~(#\+)))))
+
 (test-assertm "gexp->derivation #:references-graphs"
   (mlet* %store-monad
       ((one (text-file "one" (random-text)))
[Message part 3 (text/plain, inline)]
WDYT?
[signature.asc (application/pgp-signature, inline)]

Reply sent to Marius Bakke <mbakke <at> fastmail.com>:
You have taken responsibility. (Wed, 18 Dec 2019 22:07:02 GMT) Full text and rfc822 format available.

Notification sent to Marius Bakke <mbakke <at> fastmail.com>:
bug acknowledged by developer. (Wed, 18 Dec 2019 22:07:02 GMT) Full text and rfc822 format available.

Message #22 received at 38628-done <at> debbugs.gnu.org (full text, mbox):

From: Marius Bakke <mbakke <at> fastmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 38628-done <at> debbugs.gnu.org
Subject: Re: bug#38628: [PATCH] gexp: Allow character literals in GEXP->SEXP.
Date: Wed, 18 Dec 2019 23:06:21 +0100
[Message part 1 (text/plain, inline)]
Marius Bakke <mbakke <at> fastmail.com> writes:

> Ludovic Courtès <ludo <at> gnu.org> writes:
>
>> Also it would be nice to add a tiny test close to the one that
>> 24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c added.
>
> Good idea.  I came up with this:
>
> diff --git a/tests/gexp.scm b/tests/gexp.scm
> index 84c16422c2..8b1596f66d 100644
> --- a/tests/gexp.scm
> +++ b/tests/gexp.scm
> @@ -886,6 +886,12 @@
>      (run-with-store %store
>        (lower-gexp #~(foo #$+)))))
>  
> +(test-equal "lower-gexp, character literal"
> +  '(#\+)
> +  (lowered-gexp-sexp
> +   (run-with-store %store
> +     (lower-gexp #~(#\+)))))
> +
>  (test-assertm "gexp->derivation #:references-graphs"
>    (mlet* %store-monad
>        ((one (text-file "one" (random-text)))
>
> WDYT?

I ended up pushing this in ab7010af1f1077c056529769a53a380147c3933f,
even though I suspect there is an easier test that could reveal this
problem without involving the store, somewhere.  Improvements welcome.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-guix <at> gnu.org:
bug#38628; Package guix. (Thu, 19 Dec 2019 11:12:01 GMT) Full text and rfc822 format available.

Message #25 received at 38628-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Marius Bakke <mbakke <at> fastmail.com>
Cc: 38628-done <at> debbugs.gnu.org
Subject: Re: bug#38628: [PATCH] gexp: Allow character literals in GEXP->SEXP.
Date: Thu, 19 Dec 2019 12:11:44 +0100
Hi Marius,

Marius Bakke <mbakke <at> fastmail.com> skribis:

> Marius Bakke <mbakke <at> fastmail.com> writes:
>
>> Ludovic Courtès <ludo <at> gnu.org> writes:
>>
>>> Also it would be nice to add a tiny test close to the one that
>>> 24ab804ce11fe12ff49cd144a3d9c4bfcf55b41c added.
>>
>> Good idea.  I came up with this:
>>
>> diff --git a/tests/gexp.scm b/tests/gexp.scm
>> index 84c16422c2..8b1596f66d 100644
>> --- a/tests/gexp.scm
>> +++ b/tests/gexp.scm
>> @@ -886,6 +886,12 @@
>>      (run-with-store %store
>>        (lower-gexp #~(foo #$+)))))
>>  
>> +(test-equal "lower-gexp, character literal"
>> +  '(#\+)
>> +  (lowered-gexp-sexp
>> +   (run-with-store %store
>> +     (lower-gexp #~(#\+)))))
>> +
>>  (test-assertm "gexp->derivation #:references-graphs"
>>    (mlet* %store-monad
>>        ((one (text-file "one" (random-text)))
>>
>> WDYT?
>
> I ended up pushing this in ab7010af1f1077c056529769a53a380147c3933f,
> even though I suspect there is an easier test that could reveal this
> problem without involving the store, somewhere.  Improvements welcome.

We could have called ‘gexp->sexp’ directly, but we’d still need the
store anyway, so IMO that’s good!

Thanks,
Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 16 Jan 2020 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 101 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.