From unknown Wed Jun 18 23:03:54 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#41870 <41870@debbugs.gnu.org> To: bug#41870 <41870@debbugs.gnu.org> Subject: Status: [PATCH 0/2] Allow '.guix-channel' to advertise the primary URL Reply-To: bug#41870 <41870@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:03:54 +0000 retitle 41870 [PATCH 0/2] Allow '.guix-channel' to advertise the primary URL reassign 41870 guix-patches submitter 41870 Ludovic Court=C3=A8s severity 41870 normal tag 41870 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 15 11:12:13 2020 Received: (at submit) by debbugs.gnu.org; 15 Jun 2020 15:12:13 +0000 Received: from localhost ([127.0.0.1]:47172 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkqmT-0007Mr-JS for submit@debbugs.gnu.org; Mon, 15 Jun 2020 11:12:13 -0400 Received: from lists.gnu.org ([209.51.188.17]:36246) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkqmQ-0007Mj-Ow for submit@debbugs.gnu.org; Mon, 15 Jun 2020 11:12:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jkqmQ-0003Dw-8J for guix-patches@gnu.org; Mon, 15 Jun 2020 11:12:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38298) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkqmP-0007tC-6Z; Mon, 15 Jun 2020 11:12:09 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39836 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkqmO-00040w-Oe; Mon, 15 Jun 2020 11:12:08 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH 0/2] Allow '.guix-channel' to advertise the primary URL Date: Mon, 15 Jun 2020 17:12:01 +0200 Message-Id: <20200615151201.533-1-ludo@gnu.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: submit Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! As discussed in , this patch provides a way for channel authors to state what the primary URL of their channel is. The goal here is simply to warn users when they are pulling from a mirror so that they cannot be tricked into pulling from a stale mirror. This goes on top of . Thoughts? Ludo’. Ludovic Courtès (2): channels: Warn when pulling from a mirror. .guix-channel: Add primary URL. .guix-channel | 3 ++- doc/guix.texi | 22 ++++++++++++++++++++++ guix/channels.scm | 29 +++++++++++++++++++++++++---- 3 files changed, 49 insertions(+), 5 deletions(-) -- 2.26.2 From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 15 11:21:05 2020 Received: (at 41870) by debbugs.gnu.org; 15 Jun 2020 15:21:05 +0000 Received: from localhost ([127.0.0.1]:47191 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkqv2-0007bx-Lk for submit@debbugs.gnu.org; Mon, 15 Jun 2020 11:21:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkqv1-0007af-9b for 41870@debbugs.gnu.org; Mon, 15 Jun 2020 11:21:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38475) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkquv-0001FE-Nl; Mon, 15 Jun 2020 11:20:57 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39854 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkquv-0004s4-7k; Mon, 15 Jun 2020 11:20:57 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 41870@debbugs.gnu.org Subject: [PATCH 1/2] channels: Warn when pulling from a mirror. Date: Mon, 15 Jun 2020 17:20:48 +0200 Message-Id: <20200615152049.1047-1-ludo@gnu.org> X-Mailer: git-send-email 2.26.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41870 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * guix/channels.scm ()[url]: New field. (read-channel-metadata): Initialize it. (read-channel-metadata-from-source): Likewise. (channel-instance-primary-url): New procedure. (latest-channel-instances): Compare CHANNEL's URL against it. * doc/guix.texi (Channels)[Primary URL]: New subsection. --- doc/guix.texi | 22 ++++++++++++++++++++++ guix/channels.scm | 29 +++++++++++++++++++++++++---- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 81a11c6756..16ef5bf42e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4153,6 +4153,28 @@ add a meta-data file @file{.guix-channel} that contains: (directory "guix")) @end lisp +@cindex primary URL, channels +@subsection Primary URL + +Channel authors can indicate the primary URL of their channel's Git +repository in the @file{.guix-channel} file, like so: + +@lisp +(channel + (version 0) + (url "https://example.org/guix.git")) +@end lisp + +This allows @command{guix pull} to determine whether it is pulling code +from a mirror of the channel; when that is the case, it warns the user +that the mirror might be stale and displays the primary URL. That way, +users cannot be tricked into fetching code from a stale mirror that does +not receive security updates. + +This feature only makes sense for authenticated repositories, such as +the official @code{guix} channel, for which @command{guix pull} ensures +the code it fetches is authentic. + @cindex news, for channels @subsection Writing Channel News diff --git a/guix/channels.scm b/guix/channels.scm index 38ec68fec1..7e4d6e4c84 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -182,12 +182,13 @@ introduction, add it." (checkout channel-instance-checkout)) (define-record-type - (channel-metadata directory dependencies news-file keyring-reference) + (channel-metadata directory dependencies news-file keyring-reference url) channel-metadata? (directory channel-metadata-directory) ;string with leading slash (dependencies channel-metadata-dependencies) ;list of (news-file channel-metadata-news-file) ;string | #f - (keyring-reference channel-metadata-keyring-reference)) ;string + (keyring-reference channel-metadata-keyring-reference) ;string + (url channel-metadata-url)) ;string | #f (define %default-keyring-reference ;; Default value of the 'keyring-reference' field. @@ -209,6 +210,7 @@ if valid metadata could not be read from PORT." (let ((directory (and=> (assoc-ref properties 'directory) first)) (dependencies (or (assoc-ref properties 'dependencies) '())) (news-file (and=> (assoc-ref properties 'news-file) first)) + (url (and=> (assoc-ref properties 'url) first)) (keyring-reference (or (and=> (assoc-ref properties 'keyring-reference) first) %default-keyring-reference))) @@ -229,7 +231,8 @@ if valid metadata could not be read from PORT." (commit (get 'commit)))))) dependencies) news-file - keyring-reference))) + keyring-reference + url))) ((and ('channel ('version version) _ ...) sexp) (raise (condition (&message (message "unsupported '.guix-channel' version")) @@ -253,7 +256,7 @@ doesn't exist." read-channel-metadata)) (lambda args (if (= ENOENT (system-error-errno args)) - (channel-metadata "/" '() #f %default-keyring-reference) + (channel-metadata "/" '() #f %default-keyring-reference #f) (apply throw args))))) (define (channel-instance-metadata instance) @@ -463,6 +466,11 @@ been tampered with and is trying to force a roll-back, preventing you from getting the latest updates. If you think this is not the case, explicitly allow non-forward updates.")))))))))) +(define (channel-instance-primary-url instance) + "Return the primary URL advertised for INSTANCE, or #f if there is no such +information." + (channel-metadata-url (channel-instance-metadata instance))) + (define* (latest-channel-instances store channels #:key (current-channels '()) @@ -518,6 +526,19 @@ depending on the policy it implements." validate-pull #:starting-commit current))) + (when authenticate? + ;; CHANNEL is authenticated so we can trust the + ;; primary URL advertised in its metadata and warn + ;; about possibly stale mirrors. + (let ((primary-url (channel-instance-primary-url + instance))) + (unless (or (not primary-url) + (channel-commit channel) + (string=? primary-url (channel-url channel))) + (warning (G_ "pulled channel '~a' from a mirror \ +of ~a, which might be stale~%") + (channel-name channel) + primary-url)))) (let-values (((new-instances new-channels) (loop (channel-instance-dependencies instance) -- 2.26.2 From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 15 11:21:07 2020 Received: (at 41870) by debbugs.gnu.org; 15 Jun 2020 15:21:07 +0000 Received: from localhost ([127.0.0.1]:47194 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkqv5-0007cE-0b for submit@debbugs.gnu.org; Mon, 15 Jun 2020 11:21:07 -0400 Received: from eggs.gnu.org ([209.51.188.92]:54548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jkqv3-0007ai-Ln for 41870@debbugs.gnu.org; Mon, 15 Jun 2020 11:21:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:38478) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jkquy-0001Ff-Ej; Mon, 15 Jun 2020 11:21:00 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=39854 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jkqux-0004s4-Vr; Mon, 15 Jun 2020 11:21:00 -0400 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: 41870@debbugs.gnu.org Subject: [PATCH 2/2] .guix-channel: Add primary URL. Date: Mon, 15 Jun 2020 17:20:49 +0200 Message-Id: <20200615152049.1047-2-ludo@gnu.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200615152049.1047-1-ludo@gnu.org> References: <20200615152049.1047-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41870 Cc: =?UTF-8?q?Ludovic=20Court=C3=A8s?= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) * .guix-channel: Add 'url'. --- .guix-channel | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.guix-channel b/.guix-channel index f4459f1de1..b852180cf2 100644 --- a/.guix-channel +++ b/.guix-channel @@ -3,4 +3,5 @@ (channel (version 0) (news-file "etc/news.scm") - (keyring-reference "keyring")) + (keyring-reference "keyring") + (url "https://git.savannah.gnu.org/git/guix.git")) ;the primary URL -- 2.26.2 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 17 13:34:13 2020 Received: (at 41870-done) by debbugs.gnu.org; 17 Jun 2020 17:34:13 +0000 Received: from localhost ([127.0.0.1]:52118 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jlbwz-0001pm-AM for submit@debbugs.gnu.org; Wed, 17 Jun 2020 13:34:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45400) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1jlbwu-0001pT-BU for 41870-done@debbugs.gnu.org; Wed, 17 Jun 2020 13:34:11 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:48615) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jlbwo-0005Fy-HF for 41870-done@debbugs.gnu.org; Wed, 17 Jun 2020 13:34:02 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=58216 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1jlbwb-0002yv-AA for 41870-done@debbugs.gnu.org; Wed, 17 Jun 2020 13:33:59 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 41870-done@debbugs.gnu.org Subject: Re: [bug#41870] [PATCH 0/2] Allow '.guix-channel' to advertise the primary URL References: <20200615151201.533-1-ludo@gnu.org> Date: Wed, 17 Jun 2020 19:33:47 +0200 In-Reply-To: <20200615151201.533-1-ludo@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\?\= \=\?utf-8\?Q\?\=C3\=A8s\=22's\?\= message of "Mon, 15 Jun 2020 17:12:01 +0200") Message-ID: <87pn9xppfo.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 41870-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Ludovic Court=C3=A8s skribis: > channels: Warn when pulling from a mirror. > .guix-channel: Add primary URL. Pushed as 8b1f7c03d239ca703b56f2a6e5f228c79bc1857e. Ludo=E2=80=99. From unknown Wed Jun 18 23:03:54 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 16 Jul 2020 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator