GNU bug report logs - #50982
[PATCH] scripts: home/system: Don’t throw an error if no generations exist.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: guix-patches; Reported by: Xinglu Chen <public@HIDDEN>; Keywords: patch; dated Sat, 2 Oct 2021 21:06:02 UTC; Maintainer for guix-patches is guix-patches@HIDDEN.

Message received at 50982 <at> debbugs.gnu.org:


Received: (at 50982) by debbugs.gnu.org; 19 Oct 2021 13:59:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 19 09:59:22 2021
Received: from localhost ([127.0.0.1]:51617 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mcpeE-0008DM-3S
	for submit <at> debbugs.gnu.org; Tue, 19 Oct 2021 09:59:22 -0400
Received: from eggs.gnu.org ([209.51.188.92]:58310)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ludo@HIDDEN>) id 1mcpeC-0008D9-Av
 for 50982 <at> debbugs.gnu.org; Tue, 19 Oct 2021 09:59:21 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:54536)
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <ludo@HIDDEN>)
 id 1mcpe3-0006xx-Rd; Tue, 19 Oct 2021 09:59:13 -0400
Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:52963
 helo=ribbon)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <ludo@HIDDEN>)
 id 1mcpe3-0008LT-IW; Tue, 19 Oct 2021 09:59:11 -0400
From: =?utf-8?Q?Ludovic_Court=C3=A8s?= <ludo@HIDDEN>
To: Maxime Devos <maximedevos@HIDDEN>
Subject: Re: bug#50982: [PATCH] scripts: home/system: =?utf-8?Q?Don?=
 =?utf-8?Q?=E2=80=99t?= throw an error if no generations exist.
References: <8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@HIDDEN>
 <dcec2546aea2940cae52274422a643ef5a0189da.camel@HIDDEN>
Date: Tue, 19 Oct 2021 15:59:08 +0200
In-Reply-To: <dcec2546aea2940cae52274422a643ef5a0189da.camel@HIDDEN>
 (Maxime Devos's message of "Sun, 03 Oct 2021 10:53:31 +0200")
Message-ID: <87o87l86ab.fsf_-_@HIDDEN>
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-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 50982
Cc: 50982 <at> debbugs.gnu.org, Xinglu Chen <public@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi Xinglu,

Did you have a chance to look into this?

TIA!

Ludo=E2=80=99.

Maxime Devos <maximedevos@HIDDEN> skribis:

> Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
>> Previously, When running =E2=80=98guix home describe=E2=80=99 or =E2=80=
=98guix system describe=E2=80=99 prior
>> to having any generations, a backtrace would produced.  Since not having=
 any
>> existing generations is not an error, a warning would be enough.
>>=20
>>   $ guix system describe
>>   guix system: warning: no system generation, nothing to describe
>
> Printing a warning instead of an error to avoid a backrace isn't necessar=
y.
> E.g., "guix show i-do-not-exists" prints an error
> =E2=80=98guix show: error: i-do-not-exist: package not found=E2=80=99.
>
> I suggest using (leave (G_ "bla bla")) instead of (error (G_ "bla bla"))
> for these kind of errors, it appears to work '%find-package' in (gnu pack=
ages).
>
> I don't know if the output of "guix system describe" and "guix home descr=
ibe"
> should be an error or warning here ...
>
> Greetings,
> Maxime.




Information forwarded to guix-patches@HIDDEN:
bug#50982; Package guix-patches. Full text available.

Message received at 50982 <at> debbugs.gnu.org:


Received: (at 50982) by debbugs.gnu.org; 3 Oct 2021 08:53:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 03 04:53:35 2021
Received: from localhost ([127.0.0.1]:60975 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mWxFX-00088Y-52
	for submit <at> debbugs.gnu.org; Sun, 03 Oct 2021 04:53:35 -0400
Received: from laurent.telenet-ops.be ([195.130.137.89]:52770)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <maximedevos@HIDDEN>) id 1mWxFV-00088Q-7g
 for 50982 <at> debbugs.gnu.org; Sun, 03 Oct 2021 04:53:33 -0400
Received: from ptr-bvsjgyjmffd7q9timvx.18120a2.ip6.access.telenet.be
 ([IPv6:2a02:1811:8c09:9d00:aaf1:9810:a0b8:a55d])
 by laurent.telenet-ops.be with bizsmtp
 id 1LtX2600D0mfAB401LtX4S; Sun, 03 Oct 2021 10:53:31 +0200
Message-ID: <dcec2546aea2940cae52274422a643ef5a0189da.camel@HIDDEN>
Subject: Re: [bug#50982] [PATCH] scripts: home/system:
 =?UTF-8?Q?Don=E2=80=99t?= throw an error if no generations exist.
From: Maxime Devos <maximedevos@HIDDEN>
To: Xinglu Chen <public@HIDDEN>, 50982 <at> debbugs.gnu.org
Date: Sun, 03 Oct 2021 10:53:31 +0200
In-Reply-To: <8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@HIDDEN>
References: <8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@HIDDEN>
Content-Type: multipart/signed; micalg="pgp-sha512";
 protocol="application/pgp-signature"; boundary="=-z2FrO/1Ue4Ds0+aBMPFH"
User-Agent: Evolution 3.34.2 
MIME-Version: 1.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21;
 t=1633251211; bh=xI1pEfm/WDIiDTlacG03TDgX0lMx3X/HyOtKE2B9Zf0=;
 h=Subject:From:To:Date:In-Reply-To:References;
 b=OwCvfyH5rqPPO+IVMLQaxWFHQrwmc2Fu/HAzyFcIKAXgbCkkQS8UMZphsXgTrnD1J
 0dOMJBodPtEQo2ZNTtFJITBy+yw3l0p+Ey4rMVAk0HyqjLlloysUwR0kHWhUfb7kYY
 iGBfiTCc+UIFanw+4WL38QDclrSPMIUOUH3ofPhHdvdB5LQvCvDj1PZOOVSKqeVg21
 CCH65BmvdAtCADF07BapSOD4FAQ5+HbPiuP7pK6cP3USyNhcdnLfTk1jXt+ER3bi2k
 eKZDYOhKptlx4SHGSf8N9nTu9O62be/8YQ9wKJPvAvnvMHZap1HouItTH2MH7Ej2wZ
 GovaDRVpe8cqQ==
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 50982
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)


--=-z2FrO/1Ue4Ds0+aBMPFH
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
> Previously, When running =E2=80=98guix home describe=E2=80=99 or =E2=80=
=98guix system describe=E2=80=99 prior
> to having any generations, a backtrace would produced.  Since not having =
any
> existing generations is not an error, a warning would be enough.
>=20
>   $ guix system describe
>   guix system: warning: no system generation, nothing to describe

Printing a warning instead of an error to avoid a backrace isn't necessary.
E.g., "guix show i-do-not-exists" prints an error
=E2=80=98guix show: error: i-do-not-exist: package not found=E2=80=99.

I suggest using (leave (G_ "bla bla")) instead of (error (G_ "bla bla"))
for these kind of errors, it appears to work '%find-package' in (gnu packag=
es).

I don't know if the output of "guix system describe" and "guix home describ=
e"
should be an error or warning here ...

Greetings,
Maxime.

--=-z2FrO/1Ue4Ds0+aBMPFH
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: This is a digitally signed message part
Content-Transfer-Encoding: 7bit

-----BEGIN PGP SIGNATURE-----

iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYVlvixccbWF4aW1lZGV2
b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7iL+AQD+DVHtvsy0TySCdnPSg09nWTyo
OZbErU1Ts9wXO08JrAEA1x1AiNGcy8Tfonp9SAWKS1uXIUd/Fr+SY65oAyUEigc=
=WkOa
-----END PGP SIGNATURE-----

--=-z2FrO/1Ue4Ds0+aBMPFH--





Information forwarded to guix-patches@HIDDEN:
bug#50982; Package guix-patches. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Oct 2021 21:05:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Oct 02 17:05:58 2021
Received: from localhost ([127.0.0.1]:60721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1mWmCj-00049n-Py
	for submit <at> 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 <public@HIDDEN>) id 1mWmCi-00049V-1P
 for submit <at> 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 <public@HIDDEN>)
 id 1mWmCh-0006zf-ME
 for guix-patches@HIDDEN; 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 <public@HIDDEN>)
 id 1mWmCe-0000XS-NY
 for guix-patches@HIDDEN; Sat, 02 Oct 2021 17:05:54 -0400
From: Xinglu Chen <public@HIDDEN>
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=
To: guix-patches@HIDDEN
Subject: [PATCH] =?UTF-8?q?scripts:=20home/system:=20Don=E2=80=99t=20throw?=
 =?UTF-8?q?=20an=20error=20if=20no=20generations=20exist.?=
X-Debbugs-CC: Maxime Devos <maximedevos@HIDDEN>
Message-Id: <8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@HIDDEN>
Date: Sat, 02 Oct 2021 23:05:48 +0200
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@HIDDEN;
 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-Spam-Score: 1.7 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  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, [...] 
 
 Content analysis details:   (1.7 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -2.3 RCVD_IN_DNSWL_MED      RBL: Sender listed at https://www.dnswl.org/,
                             medium trust
                             [209.51.188.17 listed in list.dnswl.org]
  2.0 PDS_OTHER_BAD_TLD      Untrustworthy TLDs
                             [URI: yoctocell.xyz (xyz)]
  1.0 SPF_SOFTFAIL           SPF: sender does not match SPF record (softfail)
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
                             [209.51.188.17 listed in wl.mailspike.net]
  0.5 FROM_SUSPICIOUS_NTLD_FP From abused NTLD
  0.5 FROM_SUSPICIOUS_NTLD   From abused NTLD
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Previously, When running =E2=80=98guix home describe=E2=80=99 or =E2=80=98g=
uix system describe=E2=80=99 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: <https://issues.guix.gnu.org/50978>
Reported-by: Maxime Devos <maximedevos@HIDDEN>
---
 guix/scripts/home.scm   | 2 +-
 guix/scripts/system.scm | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

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)

base-commit: f1a3c11407b52004e523ec5de20d326c5661681f
--=20
2.33.0







Acknowledgement sent to Xinglu Chen <public@HIDDEN>:
New bug report received and forwarded. Copy sent to maximedevos@HIDDEN, guix-patches@HIDDEN. Full text available.
Report forwarded to maximedevos@HIDDEN, guix-patches@HIDDEN:
bug#50982; Package guix-patches. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 19 Oct 2021 14:15:02 UTC

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