[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#53355: guix shell --check: confusing error message
From: |
Ludovic Courtès |
Subject: |
bug#53355: guix shell --check: confusing error message |
Date: |
Mon, 13 Jun 2022 12:03:28 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.1 (gnu/linux) |
Hi Chris,
Chris Marusich <cmmarusich@gmail.com> skribis:
> One alternative method I tried successfully in a variety of shells was
> to use shell redirection (see attached). I like this approach.
> However, this will only work in shells that support redirection. I
> recall testing with bash, ash (busybox's shell), dash, zsh, fish, ksh,
> and csh. I recall that only csh failed, since it doesn't support
> redirection.
That’s a good success list in my view; not being a POSIX shell, (t)csh
was already excluded from the list in the original submission I think:
<https://issues.guix.gnu.org/51285>.
> I personally like the attached patch better than what I proposed
> earlier. The earlier patch just echoes a few times. Presumably, it
> only works because the PS1 prompt is likely (but not guaranteed) to be
> emitted before the last of the echo commands finishes printing. I'd
> rather just control the desired output and ignore PS1 entirely, and that
> is what the attached patch accomplishes using FDs. However, if support
> for shells without redirection is a requirement, then maybe the original
> hack (echo a few times) is OK, or perhaps we need something else.
>
> How would you like to proceed? Is it OK to rely on shell redirection?
Yeah, I think so. This new approach looks more robust.
> From 9a1cef589abf01b61e22656f44c76441f4c50ffd Mon Sep 17 00:00:00 2001
> From: Chris Marusich <cmmarusich@gmail.com>
> Date: Fri, 11 Mar 2022 00:20:12 -0800
> Subject: [PATCH] environment: Prevent PS1 from clobbering output in 'check'.
>
> Fixes: <https://issues.guix.gnu.org/51466>.
>
> * guix/scripts/environment.scm (child-shell-environment) [shell-pipe]
> [shell-pipe-in, shell-pipe-out]: New local variables.
> [script]: Redirect the stdout of each command to the file descriptor of the
> shell-pipe-out port.
> [lines]: In the child, close shell-pipe-in before starting the shell. In the
> parent, close shell-pipe-out before sending the script to the shell. Read
> lines from shell-pipe-in, not port, so that the shell's PS1 prompt cannot
> clobber the lines. Close shell-pipe-in just before waiting on the child.
LGTM, please push!
Ludo’.
- bug#53355: guix shell --check: confusing error message,
Ludovic Courtès <=