diff mbox series

[bug#66499] ui: Handle EPIPE errors when displaying Guix version.

Message ID e322b5481ff99a1dd92a60397415c4c20f35bf94.1697117770.git.zimon.toutoune@gmail.com
State New
Headers show
Series [bug#66499] ui: Handle EPIPE errors when displaying Guix version. | expand

Commit Message

Simon Tournier Oct. 12, 2023, 1:39 p.m. UTC
Fixes <https://issues.guix.gnu.org/66254>.
Reported by Clément Lassieur <clement@lassieur.org>.

* guix/ui.scm (run-guix): Handle EPIPE errors when displaying version.
---
 guix/ui.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Hi,

It appears to me a trivial patch that could directly could go be merged but
just in case I am not missing the obvious.

Cheers,
simon



base-commit: 1328c4cca531318e3ed90c6aecb522a5b22a4bcc

Comments

Mathieu Othacehe Oct. 14, 2023, 8:13 a.m. UTC | #1
Hello Simon,

> Fixes <https://issues.guix.gnu.org/66254>.
> Reported by Clément Lassieur <clement@lassieur.org>.
>
> * guix/ui.scm (run-guix): Handle EPIPE errors when displaying version.

This fixes this very issue for me too. However, all the following
commands are still failing:

guix package --help|head -1
guix package --version|head -1
guix pull --version|head -1
guix pull --help|head -1

and basically all the commands using show-version-and-exit. Do you need
a more systemic approach?

Thanks,

Mathieu
Simon Tournier Oct. 16, 2023, 5:04 p.m. UTC | #2
Hi Mathieu,

On Sat, 14 Oct 2023 at 10:13, Mathieu Othacehe <othacehe@gnu.org> wrote:

> This fixes this very issue for me too. However, all the following
> commands are still failing:
>
> guix package --help|head -1
> guix package --version|head -1
> guix pull --version|head -1
> guix pull --help|head -1

Thanks.  Fixed and the remaining others too.

> and basically all the commands using show-version-and-exit. Do you need
> a more systemic approach?

Well, I do not think we can do really better than add leave-on-EPIPE
here or there.

Maybe we could have some “define-show-help” that wraps ’show-help’
definition with leave-on-EPIPE but the effort (find-replace) is not
worth some quick additions here or there, IMHO.

Well, the first patch fixes --version for all subcommands.  All the
others deal with --help.  Now, no backtraces.

--8<---------------cut here---------------start------------->8---
$ for cmd in $(find guix/scripts -name "*.scm" -type f -exec basename {} .scm \; | sort); do ./pre-inst-env guix $cmd --version | head -1 ;done
guix archive (GNU Guix) UNKNOWN
guix authenticate (GNU Guix) UNKNOWN
guix authenticate (GNU Guix) UNKNOWN
guix build (GNU Guix) UNKNOWN
guix challenge (GNU Guix) UNKNOWN
guix container (GNU Guix) UNKNOWN
guix copy (GNU Guix) UNKNOWN
guix: cpan: command not found
Try `guix --help' for more information.
guix: cran: command not found
Try `guix --help' for more information.
guix: crate: command not found
Try `guix --help' for more information.
guix deploy (GNU Guix) UNKNOWN
guix describe (GNU Guix) UNKNOWN
guix discover (GNU Guix) UNKNOWN
guix download (GNU Guix) UNKNOWN
guix edit (GNU Guix) UNKNOWN
guix edit (GNU Guix) UNKNOWN
guix edit (GNU Guix) UNKNOWN
guix: egg: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
guix: elm: command not found
Try `guix --help' for more information.
guix: elpa: command not found
Try `guix --help' for more information.
guix environment (GNU Guix) UNKNOWN
guix: exec: command not found
Try `guix --help' for more information.
guix gc (GNU Guix) UNKNOWN
guix: gem: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
guix git (GNU Guix) UNKNOWN
guix: gnu: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
guix: go: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
guix graph (GNU Guix) UNKNOWN
guix: hackage: command not found
hint: Did you mean `package'?

Try `guix --help' for more information.
guix hash (GNU Guix) UNKNOWN
guix: hexpm: command not found
Try `guix --help' for more information.
guix home (GNU Guix) UNKNOWN
guix import (GNU Guix) UNKNOWN
guix import (GNU Guix) UNKNOWN
guix install (GNU Guix) UNKNOWN
guix: json: command not found
Try `guix --help' for more information.
guix lint (GNU Guix) UNKNOWN
guix locate (GNU Guix) UNKNOWN
guix: minetest: command not found
Try `guix --help' for more information.
guix offload (GNU Guix) UNKNOWN
guix: opam: command not found
Try `guix --help' for more information.
guix pack (GNU Guix) UNKNOWN
guix package (GNU Guix) UNKNOWN
/home/simon/src/guix/guix/scripts/guix (GNU Guix) UNKNOWN
guix processes (GNU Guix) UNKNOWN
guix publish (GNU Guix) UNKNOWN
guix pull (GNU Guix) UNKNOWN
guix: pypi: command not found
Try `guix --help' for more information.
guix: reconfigure: command not found
Try `guix --help' for more information.
guix refresh (GNU Guix) UNKNOWN
guix remove (GNU Guix) UNKNOWN
guix repl (GNU Guix) UNKNOWN
guix search (GNU Guix) UNKNOWN
guix search (GNU Guix) UNKNOWN
guix shell (GNU Guix) UNKNOWN
guix show (GNU Guix) UNKNOWN
guix size (GNU Guix) UNKNOWN
guix: stackage: command not found
hint: Did you mean `package'?

Try `guix --help' for more information.
guix style (GNU Guix) UNKNOWN
guix substitute (GNU Guix) UNKNOWN
guix system (GNU Guix) UNKNOWN
guix: texlive: command not found
Try `guix --help' for more information.
guix time-machine (GNU Guix) UNKNOWN
guix upgrade (GNU Guix) UNKNOWN
guix weather (GNU Guix) UNKNOWN
--8<---------------cut here---------------end--------------->8---

--8<---------------cut here---------------start------------->8---
$ for cmd in $(find guix/scripts -name "*.scm" -type f -exec basename {} .scm \; | sort); do ./pre-inst-env guix $cmd --help | head -1 ;done
Usage: guix archive [OPTION]... PACKAGE...
Usage: guix authenticate OPTION...
Usage: guix authenticate OPTION...
Usage: guix build [OPTION]... PACKAGE-OR-DERIVATION...
Usage: guix challenge [PACKAGE...]
Usage: guix container ACTION ARGS...
Usage: guix copy [OPTION]... ITEMS...
guix: cpan: command not found
Try `guix --help' for more information.
guix: cran: command not found
Try `guix --help' for more information.
guix: crate: command not found
Try `guix --help' for more information.
Usage: guix deploy [OPTION] FILE...
Usage: guix describe [OPTION]...
Usage: guix discover [OPTION]...
Usage: guix download [OPTION] URL
Usage: guix edit PACKAGE...
Usage: guix edit PACKAGE...
Usage: guix edit PACKAGE...
guix: egg: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
guix: elm: command not found
Try `guix --help' for more information.
guix: elpa: command not found
Try `guix --help' for more information.
Usage: guix environment [OPTION]... PACKAGE... [-- COMMAND...]
guix environment: warning: This command is deprecated in favor of 'guix shell'.
guix environment: error: fport_write: Broken pipe
guix: exec: command not found
Try `guix --help' for more information.
Usage: guix gc [OPTION]... PATHS...
guix: gem: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
Usage: guix git COMMAND ARGS...
guix: gnu: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
guix: go: command not found
hint: Did you mean `gc'?

Try `guix --help' for more information.
Usage: guix graph PACKAGE...
guix: hackage: command not found
hint: Did you mean `package'?

Try `guix --help' for more information.
Usage: guix hash [OPTION] FILE
guix: hexpm: command not found
Try `guix --help' for more information.
Usage: guix home [OPTION ...] ACTION [ARG ...] [FILE]
Usage: guix import IMPORTER ARGS ...
Usage: guix import IMPORTER ARGS ...
Usage: guix install [OPTION] PACKAGES...
guix: json: command not found
Try `guix --help' for more information.
Usage: guix lint [OPTION]... [PACKAGE]...
Usage: guix locate [OPTIONS...] FILE...
guix: minetest: command not found
Try `guix --help' for more information.
Usage: guix offload SYSTEM MAX-SILENT-TIME PRINT-BUILD-TRACE? BUILD-TIMEOUT
guix: opam: command not found
Try `guix --help' for more information.
Usage: guix pack [OPTION]... PACKAGE...
Usage: guix package [OPTION]...
guix perform-download: error: fixed-output derivation and output file name expected
Usage: guix processes
Usage: guix publish [OPTION]...
Usage: guix pull [OPTION]...
guix: pypi: command not found
Try `guix --help' for more information.
guix: reconfigure: command not found
Try `guix --help' for more information.
Usage: guix refresh [OPTION]... [PACKAGE]...
Usage: guix remove [OPTION] PACKAGES...
Usage: guix repl [OPTIONS...] [-- FILE ARGS...]
Usage: guix search [OPTION] REGEXPS...
Usage: guix search [OPTION] REGEXPS...
Usage: guix shell [OPTION] PACKAGES... [-- COMMAND...]
Usage: guix show [OPTION] PACKAGE...
Usage: guix size [OPTION]... PACKAGE|STORE-ITEM
guix: stackage: command not found
hint: Did you mean `package'?

Try `guix --help' for more information.
Usage: guix style [OPTION]... [PACKAGE]...
Usage: guix substitute OPTION [ARGUMENT]...
Usage: guix system [OPTION ...] ACTION [ARG ...] [FILE]
guix: texlive: command not found
Try `guix --help' for more information.
Usage: guix time-machine [OPTION] -- COMMAND ARGS...
Usage: guix upgrade [OPTION] [REGEXP]
Usage: guix weather [OPTIONS] [PACKAGES ...]
--8<---------------cut here---------------end--------------->8---

Cheers,
simon
Mathieu Othacehe Oct. 17, 2023, 9:47 a.m. UTC | #3
Hello,

> Well, I do not think we can do really better than add leave-on-EPIPE
> here or there.

Thanks for taking care of that :).

It looks OK to me.

Mathieu
Simon Tournier Oct. 17, 2023, 12:57 p.m. UTC | #4
Hi,

On Tue, 17 Oct 2023 at 11:48, Mathieu Othacehe <othacehe@gnu.org> wrote:

> It looks OK to me.

Thanks.  Pushed and closing.

Cheers,
simon
diff mbox series

Patch

diff --git a/guix/ui.scm b/guix/ui.scm
index 6f2d4fe245..507bc67f1d 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -2309,7 +2309,7 @@  (define (run-guix . args)
       ((or ("-h") ("--help"))
        (leave-on-EPIPE (show-guix-help)))
       ((or ("-V") ("--version"))
-       (show-version-and-exit "guix"))
+       (leave-on-EPIPE (show-version-and-exit "guix")))
       (((? option? o) args ...)
        (format (current-error-port)
                (G_ "guix: unrecognized option '~a'~%") o)