From patchwork Sat Oct 2 21:05:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xinglu Chen X-Patchwork-Id: 33584 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 42B6A27BBE3; Sat, 2 Oct 2021 22:06:22 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID, URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id CC45027BBE1 for ; Sat, 2 Oct 2021 22:06:21 +0100 (BST) Received: from localhost ([::1]:47476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mWmD6-00071a-Rv for patchwork@mira.cbaines.net; Sat, 02 Oct 2021 17:06:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39110) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWmCp-00070S-On for guix-patches@gnu.org; Sat, 02 Oct 2021 17:06:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49176) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mWmCp-0000iw-CQ for guix-patches@gnu.org; Sat, 02 Oct 2021 17:06:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mWmCo-0004AM-FM; Sat, 02 Oct 2021 17:06:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50982] [PATCH] scripts: home/system: =?utf-8?b?RG9u4oCZdA==?= throw an error if no generations exist. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: maximedevos@telenet.be, guix-patches@gnu.org Resent-Date: Sat, 02 Oct 2021 21:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50982 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50982@debbugs.gnu.org Cc: Maxime Devos X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Maxime Devos Received: via spool by submit@debbugs.gnu.org id=B.163320875815989 (code B ref -1); Sat, 02 Oct 2021 21:06:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Oct 2021 21:05:58 +0000 Received: from localhost ([127.0.0.1]:60721 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWmCj-00049n-Py for submit@debbugs.gnu.org; Sat, 02 Oct 2021 17:05:58 -0400 Received: from lists.gnu.org ([209.51.188.17]:50860) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mWmCi-00049V-1P for submit@debbugs.gnu.org; Sat, 02 Oct 2021 17:05:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39094) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWmCh-0006zf-ME for guix-patches@gnu.org; Sat, 02 Oct 2021 17:05:55 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:55238 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mWmCe-0000XS-NY for guix-patches@gnu.org; Sat, 02 Oct 2021 17:05:54 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1633208748; bh=DFxrS4/6G3q7aKSOBrXHfBZ2BQqLG6QsfAKuxsfC2P0=; h=From:To:Subject:Date; b=r9AAdtnIs1SD7KM5faw1Bb8hF+KLjBZf6AxSOMufBNnnBWRp32Gyn1sxxkW85R2iG M9hHmUNuojtQZNhjvpT2k7bbwTOzLVxB2JfvYIVCv6WSuw1KbVN1ZKfQ8zGWS+ySN0 dTWu8g6waBlXsrSg+haPxaVfKBK5fcxTvih4iKXU= Message-Id: <8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@yoctocell.xyz> Date: Sat, 02 Oct 2021 23:05:48 +0200 MIME-Version: 1.0 Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 39 X-Spam_score: 3.9 X-Spam_bar: +++ X-Spam_report: (3.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.5, FROM_SUSPICIOUS_NTLD_FP=0.233, PDS_OTHER_BAD_TLD=1.999, PDS_RDNS_DYNAMIC_FP=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TO_NO_BRKTS_DYNIP=2.299 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches Previously, When running ‘guix home describe’ or ‘guix system describe’ prior to having any generations, a backtrace would produced. Since not having any existing generations is not an error, a warning would be enough. $ guix system describe guix system: warning: no system generation, nothing to describe * guix/scripts/home.scm (process-command): Produce a warning instead of an error if no generations exist. * guix/scripts/system.scm (process-command): Likewise. Fixes: Reported-by: Maxime Devos --- guix/scripts/home.scm | 2 +- guix/scripts/system.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) base-commit: f1a3c11407b52004e523ec5de20d326c5661681f diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index 75df6d707d..70860564eb 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -260,7 +260,7 @@ (define-syntax-rule (with-store* store exp ...) ((describe) (match (generation-number %guix-home) (0 - (error (G_ "no home environment generation, nothing to describe~%"))) + (warning (G_ "no home environment generation, nothing to describe~%"))) (generation (display-home-environment-generation generation)))) ((list-generations) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 65eb98e4b2..d77d3ea289 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -1307,7 +1307,7 @@ (define-syntax-rule (with-store* store exp ...) ((describe) (match (generation-number %system-profile) (0 - (error (G_ "no system generation, nothing to describe~%"))) + (warning (G_ "no system generation, nothing to describe~%"))) (generation (display-system-generation generation)))) ((search)