GNU bug report logs - #45409
[PATCH 0/3] Move some (guix scripts substitute) code to two new modules

Previous Next

Package: guix-patches;

Reported by: Christopher Baines <mail <at> cbaines.net>

Date: Thu, 24 Dec 2020 17:19:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ludovic Courtès <ludo <at> gnu.org>
To: Christopher Baines <mail <at> cbaines.net>
Cc: 45409 <at> debbugs.gnu.org
Subject: [bug#45409] [PATCH v3 1/3] substitute: Untangle skipping authentication from valid-narinfo?.
Date: Tue, 05 Jan 2021 22:57:06 +0100
[Message part 1 (text/plain, inline)]
Hi,

Christopher Baines <mail <at> cbaines.net> skribis:

> Rather than having valid-narinfo? evaluate to #t if
> %allow-unauthenticated-substitutes? is set to #t, just use (const #t) for
> valid-narinfo? when %allow-unauthenticated-substitutes? is set to #t.  This
> will allow moving valid-narinfo? in to a (guix substitutes) module.
>
> * guix/scripts/substitute.scm (process-query, process-substitution): Change
> the authorized? argument to lookup-narinfo and lookup-narinfos/diverse based
> on %allow-unauthenticated-substitutes?.
> (valid-narinfo?): Remove use of %allow-unauthenticated-substitutes?.

Bummer that there are two call sites.

What about doing away with ‘%allow-unauthenticated-substitutes?’ and
instead changing its only user, ‘tests/substitute.scm’, like so:

[Message part 2 (text/x-patch, inline)]
diff --git a/tests/substitute.scm b/tests/substitute.scm
index 542aaf603f..1827ffe8d4 100644
--- a/tests/substitute.scm
+++ b/tests/substitute.scm
@@ -178,10 +178,10 @@ a file for NARINFO."
         (call-with-output-file
             (string-append narinfo-directory "/example.nar")
           (cute write-file
-                (string-append narinfo-directory "/example.out") <>))
-
-        (%allow-unauthenticated-substitutes? #f))
-      thunk
+                (string-append narinfo-directory "/example.out") <>)))
+      (lambda ()
+        (mock ((guix narinfo) valid-narinfo?) (const #t)
+              (thunk)))
       (lambda ()
         (when (file-exists? cache-directory)
           (delete-file-recursively cache-directory))))))
[Message part 3 (text/plain, inline)]
That change would have to be made in the patch that creates (guix
narinfo).

WDYT?

Ludo’.

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

Previous Next


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