From unknown Sat Sep 20 04:10:03 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#53476] [PATCH] home: 'reconfigure' checks for potential downgrades. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Jan 2022 15:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 53476 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53476@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.164295154614425 (code B ref -1); Sun, 23 Jan 2022 15:26:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jan 2022 15:25:46 +0000 Received: from localhost ([127.0.0.1]:40834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBekT-0003ka-Mp for submit@debbugs.gnu.org; Sun, 23 Jan 2022 10:25:46 -0500 Received: from lists.gnu.org ([209.51.188.17]:44858) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBekS-0003kT-LR for submit@debbugs.gnu.org; Sun, 23 Jan 2022 10:25:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBekS-0004i8-Fk for guix-patches@gnu.org; Sun, 23 Jan 2022 10:25:44 -0500 Received: from [2001:470:142:3::e] (port=42814 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBekP-0008WO-Pe; Sun, 23 Jan 2022 10:25:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=UcIH1L4hyBQahdKpghCvu0HFdPDBeQ363MuJBbvteqg=; b=NFmvPssc65afY0 Ous3NM1RrSmTkfmehy5Y/tUQwUQi9T2Ueu03sggNU/nxn/ajW5KsBxx6+6s8miDrFp4saDIN2EVMO H/89LmSYR4LaKknMzuVCDJR0fV9W+qRbVa0JAFFLKY9St3BtF85RFpc2iKiEo2X5gHCxMNbDLn2Hm 3/mp7OVdNe5BXQFqPrI9tZCoFN+grDbe4oaplGdkQST4ElixsWkfBkpoHpOAsZbH2Og+zzJj/6g2i w/YvQvfqhXGf2rXRcHRUWK/vddjWbAXCQmTJlOpa7YvFBKiqUdYF5YO8AUc2JUmMzJBe9369TsZJe hO89eRVeykodmvA7vAZQ==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57244 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBekI-00022f-MP; Sun, 23 Jan 2022 10:25:39 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Sun, 23 Jan 2022 16:25:25 +0100 Message-Id: <20220123152525.3211-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) 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/scripts/home.scm (show-help, %options): Add "--allow-downgrades". (%default-options): Remove 'build-mode'; add 'validate-reconfigure'. (perform-action): Add #:validate-reconfigure. Call 'check-forward-update' when ACTION is 'reconfigure. (process-action): Pass #:validate-reconfigure to 'perform-action'. * gnu/home/services.scm (home-provenance): Export. * doc/guix.texi (Invoking guix home): Document '--allow-downgrades'. --- doc/guix.texi | 10 ++++++++++ gnu/home/services.scm | 1 + guix/scripts/home.scm | 37 +++++++++++++++++++++++++------------ 3 files changed, 36 insertions(+), 12 deletions(-) Hello! This patch adds downgrade protection to ‘guix home reconfigure’, as already implemented in ‘guix system reconfigure’ and ‘guix deploy’. Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index 912a8e3c5a..22dc5f6156 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37791,6 +37791,16 @@ Consider the home-environment @var{expr} evaluates to. This is an alternative to specifying a file which evaluates to a home environment. +@item --allow-downgrades +Instruct @command{guix home reconfigure} to allow system downgrades. + +Just like @command{guix system}, @command{guix home reconfigure}, by +default, prevents you from downgrading your home to older or unrelated +revisions compared to the channel revisions that were used to deploy +it---those shown by @command{guix home describe}. Using +@option{--allow-downgrades} allows you to bypass that check, at the risk +of downgrading your home---be careful! + @end table @node Documentation diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 2a3cb44952..1c860d7b01 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -43,6 +43,7 @@ (define-module (gnu home services) home-provenance-service-type fold-home-service-types + home-provenance %initialize-gettext) diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index 2312e4d313..837fd96361 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -36,7 +36,8 @@ (define-module (guix scripts home) #:use-module (guix scripts) #:use-module (guix scripts package) #:use-module (guix scripts build) - #:use-module (guix scripts system search) + #:autoload (guix scripts system search) (service-type->recutils) + #:use-module (guix scripts system reconfigure) #:autoload (guix scripts pull) (channel-commit-hyperlink) #:use-module (guix scripts home import) #:use-module ((guix status) #:select (with-status-verbosity)) @@ -91,6 +92,9 @@ (define (show-help) (display (G_ " -e, --expression=EXPR consider the home-environment EXPR evaluates to instead of reading FILE, when applicable")) + (display (G_ " + --allow-downgrades for 'reconfigure', allow downgrades to earlier + channel revisions")) (display (G_ " -v, --verbosity=LEVEL use the given verbosity LEVEL")) (newline) @@ -127,18 +131,23 @@ (define %options (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) + (option '("allow-downgrades") #f #f + (lambda (opt name arg result) + (alist-cons 'validate-reconfigure + warn-about-backward-reconfigure + result))) %standard-build-options)) (define %default-options - `((build-mode . ,(build-mode normal)) - (graft? . #t) + `((graft? . #t) (substitutes? . #t) (offload? . #t) (print-build-trace? . #t) (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) (verbosity . #f) ;default - (debug . 0))) + (debug . 0) + (validate-reconfigure . ,ensure-forward-reconfigure))) ;;; @@ -149,12 +158,17 @@ (define* (perform-action action he #:key dry-run? derivations-only? - use-substitutes?) + use-substitutes? + (validate-reconfigure ensure-forward-reconfigure)) "Perform ACTION for home environment. " (define println (cut format #t "~a~%" <>)) + (when (eq? action 'reconfigure) + (check-forward-update validate-reconfigure + #:current-channels (home-provenance %guix-home))) + (mlet* %store-monad ((he-drv (home-environment-derivation he)) (drvs (mapm/accumulate-builds lower-object (list he-drv))) @@ -237,13 +251,12 @@ (define (ensure-home-environment file-or-exp obj) (mbegin %store-monad (set-guile-for-build (default-guile)) - (case action - (else - (perform-action action home-environment - #:dry-run? dry? - #:derivations-only? (assoc-ref opts 'derivations-only?) - #:use-substitutes? (assoc-ref opts 'substitutes?)) - )))))) + (perform-action action home-environment + #:dry-run? dry? + #:derivations-only? (assoc-ref opts 'derivations-only?) + #:use-substitutes? (assoc-ref opts 'substitutes?) + #:validate-reconfigure + (assoc-ref opts 'validate-reconfigure)))))) (warn-about-disk-space))) base-commit: ee6bf00b2d89f6acab55b7a82896d99e39c1229b -- 2.34.0 From unknown Sat Sep 20 04:10:03 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Subject: bug#53476: closed (Re: bug#53476: [PATCH] home: 'reconfigure' checks for potential downgrades.) Message-ID: References: <87leyzbhbw.fsf@gnu.org> <20220123152525.3211-1-ludo@gnu.org> X-Gnu-PR-Message: they-closed 53476 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 53476@debbugs.gnu.org Date: Fri, 28 Jan 2022 22:57:01 +0000 Content-Type: multipart/mixed; boundary="----------=_1643410621-23512-1" This is a multi-part message in MIME format... ------------=_1643410621-23512-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #53476: [PATCH] home: 'reconfigure' checks for potential downgrades. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 53476@debbugs.gnu.org. --=20 53476: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D53476 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1643410621-23512-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 53476-done) by debbugs.gnu.org; 28 Jan 2022 22:56:12 +0000 Received: from localhost ([127.0.0.1]:60695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDaA7-000662-OI for submit@debbugs.gnu.org; Fri, 28 Jan 2022 17:56:11 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:37148) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nDaA6-00065n-GC for 53476-done@debbugs.gnu.org; Fri, 28 Jan 2022 17:56:10 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id F17CE32B for <53476-done@debbugs.gnu.org>; Fri, 28 Jan 2022 23:56:04 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VLGS43C1p_f0 for <53476-done@debbugs.gnu.org>; Fri, 28 Jan 2022 23:56:04 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 1B8252F for <53476-done@debbugs.gnu.org>; Fri, 28 Jan 2022 23:56:04 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: 53476-done@debbugs.gnu.org Subject: Re: bug#53476: [PATCH] home: 'reconfigure' checks for potential downgrades. References: <20220123152525.3211-1-ludo@gnu.org> Date: Fri, 28 Jan 2022 23:56:03 +0100 In-Reply-To: <20220123152525.3211-1-ludo@gnu.org> ("Ludovic =?utf-8?Q?Cour?= =?utf-8?Q?t=C3=A8s=22's?= message of "Sun, 23 Jan 2022 16:25:25 +0100") Message-ID: <87leyzbhbw.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: F17CE32B X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[53476-done@debbugs.gnu.org]; RCPT_COUNT_ONE(0.00)[1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 53476-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: -0.0 (/) Ludovic Court=C3=A8s skribis: > * guix/scripts/home.scm (show-help, %options): Add "--allow-downgrades". > (%default-options): Remove 'build-mode'; add 'validate-reconfigure'. > (perform-action): Add #:validate-reconfigure. Call > 'check-forward-update' when ACTION is 'reconfigure. > (process-action): Pass #:validate-reconfigure to 'perform-action'. > * gnu/home/services.scm (home-provenance): Export. > * doc/guix.texi (Invoking guix home): Document '--allow-downgrades'. Pushed as 23ccfd3840d957e28fdbe3e3af9f588320c04fe3. Ludo=E2=80=99. ------------=_1643410621-23512-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 23 Jan 2022 15:25:46 +0000 Received: from localhost ([127.0.0.1]:40834 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBekT-0003ka-Mp for submit@debbugs.gnu.org; Sun, 23 Jan 2022 10:25:46 -0500 Received: from lists.gnu.org ([209.51.188.17]:44858) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nBekS-0003kT-LR for submit@debbugs.gnu.org; Sun, 23 Jan 2022 10:25:45 -0500 Received: from eggs.gnu.org ([209.51.188.92]:38924) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBekS-0004i8-Fk for guix-patches@gnu.org; Sun, 23 Jan 2022 10:25:44 -0500 Received: from [2001:470:142:3::e] (port=42814 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBekP-0008WO-Pe; Sun, 23 Jan 2022 10:25:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=UcIH1L4hyBQahdKpghCvu0HFdPDBeQ363MuJBbvteqg=; b=NFmvPssc65afY0 Ous3NM1RrSmTkfmehy5Y/tUQwUQi9T2Ueu03sggNU/nxn/ajW5KsBxx6+6s8miDrFp4saDIN2EVMO H/89LmSYR4LaKknMzuVCDJR0fV9W+qRbVa0JAFFLKY9St3BtF85RFpc2iKiEo2X5gHCxMNbDLn2Hm 3/mp7OVdNe5BXQFqPrI9tZCoFN+grDbe4oaplGdkQST4ElixsWkfBkpoHpOAsZbH2Og+zzJj/6g2i w/YvQvfqhXGf2rXRcHRUWK/vddjWbAXCQmTJlOpa7YvFBKiqUdYF5YO8AUc2JUmMzJBe9369TsZJe hO89eRVeykodmvA7vAZQ==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57244 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nBekI-00022f-MP; Sun, 23 Jan 2022 10:25:39 -0500 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= To: guix-patches@gnu.org Subject: [PATCH] home: 'reconfigure' checks for potential downgrades. Date: Sun, 23 Jan 2022 16:25:25 +0100 Message-Id: <20220123152525.3211-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 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 (---) * guix/scripts/home.scm (show-help, %options): Add "--allow-downgrades". (%default-options): Remove 'build-mode'; add 'validate-reconfigure'. (perform-action): Add #:validate-reconfigure. Call 'check-forward-update' when ACTION is 'reconfigure. (process-action): Pass #:validate-reconfigure to 'perform-action'. * gnu/home/services.scm (home-provenance): Export. * doc/guix.texi (Invoking guix home): Document '--allow-downgrades'. --- doc/guix.texi | 10 ++++++++++ gnu/home/services.scm | 1 + guix/scripts/home.scm | 37 +++++++++++++++++++++++++------------ 3 files changed, 36 insertions(+), 12 deletions(-) Hello! This patch adds downgrade protection to ‘guix home reconfigure’, as already implemented in ‘guix system reconfigure’ and ‘guix deploy’. Ludo’. diff --git a/doc/guix.texi b/doc/guix.texi index 912a8e3c5a..22dc5f6156 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -37791,6 +37791,16 @@ Consider the home-environment @var{expr} evaluates to. This is an alternative to specifying a file which evaluates to a home environment. +@item --allow-downgrades +Instruct @command{guix home reconfigure} to allow system downgrades. + +Just like @command{guix system}, @command{guix home reconfigure}, by +default, prevents you from downgrading your home to older or unrelated +revisions compared to the channel revisions that were used to deploy +it---those shown by @command{guix home describe}. Using +@option{--allow-downgrades} allows you to bypass that check, at the risk +of downgrading your home---be careful! + @end table @node Documentation diff --git a/gnu/home/services.scm b/gnu/home/services.scm index 2a3cb44952..1c860d7b01 100644 --- a/gnu/home/services.scm +++ b/gnu/home/services.scm @@ -43,6 +43,7 @@ (define-module (gnu home services) home-provenance-service-type fold-home-service-types + home-provenance %initialize-gettext) diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index 2312e4d313..837fd96361 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -36,7 +36,8 @@ (define-module (guix scripts home) #:use-module (guix scripts) #:use-module (guix scripts package) #:use-module (guix scripts build) - #:use-module (guix scripts system search) + #:autoload (guix scripts system search) (service-type->recutils) + #:use-module (guix scripts system reconfigure) #:autoload (guix scripts pull) (channel-commit-hyperlink) #:use-module (guix scripts home import) #:use-module ((guix status) #:select (with-status-verbosity)) @@ -91,6 +92,9 @@ (define (show-help) (display (G_ " -e, --expression=EXPR consider the home-environment EXPR evaluates to instead of reading FILE, when applicable")) + (display (G_ " + --allow-downgrades for 'reconfigure', allow downgrades to earlier + channel revisions")) (display (G_ " -v, --verbosity=LEVEL use the given verbosity LEVEL")) (newline) @@ -127,18 +131,23 @@ (define %options (option '(#\e "expression") #t #f (lambda (opt name arg result) (alist-cons 'expression arg result))) + (option '("allow-downgrades") #f #f + (lambda (opt name arg result) + (alist-cons 'validate-reconfigure + warn-about-backward-reconfigure + result))) %standard-build-options)) (define %default-options - `((build-mode . ,(build-mode normal)) - (graft? . #t) + `((graft? . #t) (substitutes? . #t) (offload? . #t) (print-build-trace? . #t) (print-extended-build-trace? . #t) (multiplexed-build-output? . #t) (verbosity . #f) ;default - (debug . 0))) + (debug . 0) + (validate-reconfigure . ,ensure-forward-reconfigure))) ;;; @@ -149,12 +158,17 @@ (define* (perform-action action he #:key dry-run? derivations-only? - use-substitutes?) + use-substitutes? + (validate-reconfigure ensure-forward-reconfigure)) "Perform ACTION for home environment. " (define println (cut format #t "~a~%" <>)) + (when (eq? action 'reconfigure) + (check-forward-update validate-reconfigure + #:current-channels (home-provenance %guix-home))) + (mlet* %store-monad ((he-drv (home-environment-derivation he)) (drvs (mapm/accumulate-builds lower-object (list he-drv))) @@ -237,13 +251,12 @@ (define (ensure-home-environment file-or-exp obj) (mbegin %store-monad (set-guile-for-build (default-guile)) - (case action - (else - (perform-action action home-environment - #:dry-run? dry? - #:derivations-only? (assoc-ref opts 'derivations-only?) - #:use-substitutes? (assoc-ref opts 'substitutes?)) - )))))) + (perform-action action home-environment + #:dry-run? dry? + #:derivations-only? (assoc-ref opts 'derivations-only?) + #:use-substitutes? (assoc-ref opts 'substitutes?) + #:validate-reconfigure + (assoc-ref opts 'validate-reconfigure)))))) (warn-about-disk-space))) base-commit: ee6bf00b2d89f6acab55b7a82896d99e39c1229b -- 2.34.0 ------------=_1643410621-23512-1--