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

From: Simon Tournier <[email-masked]>
Date: Mon, 16 Oct 2023 19:04:53 +0200

Hi Mathieu,

On Sat, 14 Oct 2023 at 10:13, Mathieu Othacehe <[email-masked]> 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