Message ID | 8c1286034c3a48353d13515f04883dbede289e0c.1633208618.git.public@yoctocell.xyz |
---|---|
State | Accepted |
Headers | show |
Series | [bug#50982] scripts: home/system: Don’t throw an error if no generations exist. | expand |
Context | Check | Description |
---|---|---|
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
cbaines/comparison | success | View comparision |
cbaines/git branch | success | View Git branch |
cbaines/applying patch | success | View Laminar job |
cbaines/issue | success | View issue |
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.
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.
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?
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’.
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’.
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)