diff mbox series

[bug#61977] channels: Raise an error if dependency's introduction is malformed

Message ID e442826ed0b778e2f3eb4f2de54fe6c4c114455a.1678013769.git.dev@jpoiret.xyz
State New
Headers show
Series [bug#61977] channels: Raise an error if dependency's introduction is malformed | expand

Commit Message

Josselin Poiret March 5, 2023, 10:56 a.m. UTC
* guix/channels.scm (sexp->channel-introduction): Do it.
---
 guix/channels.scm | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)


base-commit: 2799ad44234be675f018115f99be98d2c9fd565d

Comments

Ludovic Courtès March 17, 2023, 10:14 p.m. UTC | #1
Hi Josselin,

Josselin Poiret <dev@jpoiret.xyz> skribis:

> * guix/channels.scm (sexp->channel-introduction): Do it.

To be clear, without this a malformed introduction sexp would be
silently ignored; consequently, the channel in question would not be
authenticated, in which case the “channel '~a' lacks 'introduction'
field” warning would be printed.  Am I right?

So the goal here is to catch errors in ‘.guix-channel’ earlier, right?

Thanks,
Ludo’.
Josselin Poiret March 18, 2023, 9:42 p.m. UTC | #2
Hi Ludo,

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Josselin,
>
> Josselin Poiret <dev@jpoiret.xyz> skribis:
>
>> * guix/channels.scm (sexp->channel-introduction): Do it.
>
> To be clear, without this a malformed introduction sexp would be
> silently ignored; consequently, the channel in question would not be
> authenticated, in which case the “channel '~a' lacks 'introduction'
> field” warning would be printed.  Am I right?
>
> So the goal here is to catch errors in ‘.guix-channel’ earlier, right?

Exactly!  Someone else reported this elsewhere because they were using
the syntax for a channels.scm file instead of the channel dependencies
syntax, which is different, and consumers of that channel kept getting
warning messages.

Best,
Simon Tournier May 5, 2023, 2:15 p.m. UTC | #3
Hi,

What is the status of this patch?

On dim., 05 mars 2023 at 11:56, Josselin Poiret <dev@jpoiret.xyz> wrote:
> * guix/channels.scm (sexp->channel-introduction): Do it.
> ---
>  guix/channels.scm | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/guix/channels.scm b/guix/channels.scm
> index d44e7a0a3a..fc2bf55d65 100644
> --- a/guix/channels.scm
> +++ b/guix/channels.scm
> @@ -256,7 +256,14 @@ (define sexp->channel-introduction
>                              ('commit commit) ('signer signer)
>                              _ ...)
>       (make-channel-introduction commit (openpgp-fingerprint signer)))
> -    (x #f)))
> +    (x (raise (condition
> +               (&message
> +                (message (format #f "channel dependency has an invalid\
> + introduction field")))
> +               (&error-location
> +                (location
> +                 (source-properties->location
> +                  (source-properties x)))))))))

I guess the string needs to use ’(G_ )’ for translation, no?


Cheers,
simon
Josselin Poiret June 4, 2023, 9:38 a.m. UTC | #4
Hi everyone,

Josselin Poiret <dev@jpoiret.xyz> writes:

> * guix/channels.scm (sexp->channel-introduction): Do it.

Pushed as cacc0cb6ab22218a3783a51ba9986405ede4e0d8, with Simon's
suggestion of adding G_.

Best,
diff mbox series

Patch

diff --git a/guix/channels.scm b/guix/channels.scm
index d44e7a0a3a..fc2bf55d65 100644
--- a/guix/channels.scm
+++ b/guix/channels.scm
@@ -256,7 +256,14 @@  (define sexp->channel-introduction
                             ('commit commit) ('signer signer)
                             _ ...)
      (make-channel-introduction commit (openpgp-fingerprint signer)))
-    (x #f)))
+    (x (raise (condition
+               (&message
+                (message (format #f "channel dependency has an invalid\
+ introduction field")))
+               (&error-location
+                (location
+                 (source-properties->location
+                  (source-properties x)))))))))
 
 (define (read-channel-metadata port)
   "Read from PORT channel metadata in the format expected for the