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

Previous Next

Package: guix-patches;

Reported by: Xinglu Chen <public <at> yoctocell.xyz>

Date: Sat, 2 Oct 2021 21:06:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 50982 in the body.
You can then email your comments to 50982 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to maximedevos <at> telenet.be, guix-patches <at> gnu.org:
bug#50982; Package guix-patches. (Sat, 02 Oct 2021 21:06:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xinglu Chen <public <at> yoctocell.xyz>:
New bug report received and forwarded. Copy sent to maximedevos <at> telenet.be, guix-patches <at> gnu.org. (Sat, 02 Oct 2021 21:06:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
Date: Sat, 02 Oct 2021 23:05:48 +0200
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: <https://issues.guix.gnu.org/50978>
Reported-by: Maxime Devos <maximedevos <at> telenet.be>
---
 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
-- 
2.33.0







Information forwarded to guix-patches <at> gnu.org:
bug#50982; Package guix-patches. (Sun, 03 Oct 2021 08:54:02 GMT) Full text and rfc822 format available.

Message #8 received at 50982 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: Xinglu Chen <public <at> yoctocell.xyz>, 50982 <at> debbugs.gnu.org
Subject: Re: [bug#50982] [PATCH] scripts: home/system:
 Don’t throw an error if no generations exist.
Date: Sun, 03 Oct 2021 10:53:31 +0200
[Message part 1 (text/plain, inline)]
Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
> 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

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
‘guix show: error: i-do-not-exist: package not found’.

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 packages).

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

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50982; Package guix-patches. (Tue, 19 Oct 2021 14:00:02 GMT) Full text and rfc822 format available.

Message #11 received at 50982 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 50982 <at> debbugs.gnu.org, Xinglu Chen <public <at> yoctocell.xyz>
Subject: Re: bug#50982: [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
Date: Tue, 19 Oct 2021 15:59:08 +0200
Hi Xinglu,

Did you have a chance to look into this?

TIA!

Ludo’.

Maxime Devos <maximedevos <at> telenet.be> skribis:

> Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
>> 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
>
> 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
> ‘guix show: error: i-do-not-exist: package not found’.
>
> 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 packages).
>
> I don't know if the output of "guix system describe" and "guix home describe"
> should be an error or warning here ...
>
> Greetings,
> Maxime.




Information forwarded to guix-patches <at> gnu.org:
bug#50982; Package guix-patches. (Sat, 30 Oct 2021 11:19:01 GMT) Full text and rfc822 format available.

Message #14 received at 50982 <at> debbugs.gnu.org (full text, mbox):

From: Xinglu Chen <public <at> yoctocell.xyz>
To: Maxime Devos <maximedevos <at> telenet.be>, 50982 <at> debbugs.gnu.org
Cc: Ludovic Courtès <ludo <at> gnu.org>
Subject: Re: [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
Date: Sat, 30 Oct 2021 13:18:39 +0200
[Message part 1 (text/plain, inline)]
Hi,

On Sun, Oct 03 2021, Maxime Devos wrote:

> Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
>> 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
>
> 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
> ‘guix show: error: i-do-not-exist: package not found’.
>
> 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 packages).
>
> I don't know if the output of "guix system describe" and "guix home describe"
> should be an error or warning here ...

Hmm, since I don’t think that not having any generations is an error, I
would say it makes more sense to use ‘warning’ instead of ‘leave’.
‘leave’ would signal that something isn’t correct, which makes sense if
one runs ‘guix show doesnt-exist’, but not having any generations
doesn’t really mean that something is wrong.

WDYT?
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#50982; Package guix-patches. (Sat, 30 Oct 2021 14:25:02 GMT) Full text and rfc822 format available.

Message #17 received at 50982 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Xinglu Chen <public <at> yoctocell.xyz>
Cc: 50982 <at> debbugs.gnu.org, Maxime Devos <maximedevos <at> telenet.be>
Subject: Re: [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
Date: Sat, 30 Oct 2021 16:24:45 +0200
Hi,

Xinglu Chen <public <at> yoctocell.xyz> skribis:

> On Sun, Oct 03 2021, Maxime Devos wrote:
>
>> Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
>>> 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
>>
>> 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
>> ‘guix show: error: i-do-not-exist: package not found’.
>>
>> 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 packages).
>>
>> I don't know if the output of "guix system describe" and "guix home describe"
>> should be an error or warning here ...
>
> Hmm, since I don’t think that not having any generations is an error, I
> would say it makes more sense to use ‘warning’ instead of ‘leave’.
> ‘leave’ would signal that something isn’t correct, which makes sense if
> one runs ‘guix show doesnt-exist’, but not having any generations
> doesn’t really mean that something is wrong.

Yeah, I guess ‘warning’ is fine.

Maxime’s point is that we should always use procedures from (guix
diagnostics) for error/warning/info reports.

Thanks,
Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 06 Jan 2022 10:29:02 GMT) Full text and rfc822 format available.

Notification sent to Xinglu Chen <public <at> yoctocell.xyz>:
bug acknowledged by developer. (Thu, 06 Jan 2022 10:29:02 GMT) Full text and rfc822 format available.

Message #22 received at 50982-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 50982-done <at> debbugs.gnu.org, Xinglu Chen <public <at> yoctocell.xyz>
Subject: Re: bug#50982: [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
Date: Thu, 06 Jan 2022 11:28:22 +0100
Maxime Devos <maximedevos <at> telenet.be> skribis:

> Xinglu Chen schreef op za 02-10-2021 om 23:05 [+0200]:
>> 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
>
> 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
> ‘guix show: error: i-do-not-exist: package not found’.
>
> 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 packages).

I’ve done that now, thanks!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 03 Feb 2022 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 83 days ago.

Previous Next


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