* [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
@ 2021-10-02 21:05 Xinglu Chen
2021-10-03 8:53 ` Maxime Devos
0 siblings, 1 reply; 6+ messages in thread
From: Xinglu Chen @ 2021-10-02 21:05 UTC (permalink / raw)
To: 50982; +Cc: Maxime Devos
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@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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
2021-10-02 21:05 [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist Xinglu Chen
@ 2021-10-03 8:53 ` Maxime Devos
2021-10-19 13:59 ` Ludovic Courtès
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Maxime Devos @ 2021-10-03 8:53 UTC (permalink / raw)
To: Xinglu Chen, 50982
[-- Attachment #1: Type: text/plain, Size: 885 bytes --]
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.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
2021-10-03 8:53 ` Maxime Devos
@ 2021-10-19 13:59 ` Ludovic Courtès
2021-10-30 11:18 ` Xinglu Chen
2022-01-06 10:28 ` bug#50982: " Ludovic Courtès
2 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2021-10-19 13:59 UTC (permalink / raw)
To: Maxime Devos; +Cc: 50982, Xinglu Chen
Hi Xinglu,
Did you have a chance to look into this?
TIA!
Ludo’.
Maxime Devos <maximedevos@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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
2021-10-03 8:53 ` Maxime Devos
2021-10-19 13:59 ` Ludovic Courtès
@ 2021-10-30 11:18 ` Xinglu Chen
2021-10-30 14:24 ` Ludovic Courtès
2022-01-06 10:28 ` bug#50982: " Ludovic Courtès
2 siblings, 1 reply; 6+ messages in thread
From: Xinglu Chen @ 2021-10-30 11:18 UTC (permalink / raw)
To: Maxime Devos, 50982; +Cc: Ludovic Courtès
[-- Attachment #1: Type: text/plain, Size: 1298 bytes --]
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?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 861 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
2021-10-30 11:18 ` Xinglu Chen
@ 2021-10-30 14:24 ` Ludovic Courtès
0 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2021-10-30 14:24 UTC (permalink / raw)
To: Xinglu Chen; +Cc: 50982, Maxime Devos
Hi,
Xinglu Chen <public@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’.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#50982: [PATCH] scripts: home/system: Don’t throw an error if no generations exist.
2021-10-03 8:53 ` Maxime Devos
2021-10-19 13:59 ` Ludovic Courtès
2021-10-30 11:18 ` Xinglu Chen
@ 2022-01-06 10:28 ` Ludovic Courtès
2 siblings, 0 replies; 6+ messages in thread
From: Ludovic Courtès @ 2022-01-06 10:28 UTC (permalink / raw)
To: Maxime Devos; +Cc: 50982-done, Xinglu Chen
Maxime Devos <maximedevos@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’.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-01-06 10:30 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-02 21:05 [bug#50982] [PATCH] scripts: home/system: Don’t throw an error if no generations exist Xinglu Chen
2021-10-03 8:53 ` Maxime Devos
2021-10-19 13:59 ` Ludovic Courtès
2021-10-30 11:18 ` Xinglu Chen
2021-10-30 14:24 ` Ludovic Courtès
2022-01-06 10:28 ` bug#50982: " Ludovic Courtès
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.