zsh-workers
 help / color / mirror / code / Atom feed
* bug: whence -wa / none / argv position
@ 2023-05-27  5:25 Phil Pennock
  2023-06-24  1:55 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Phil Pennock @ 2023-05-27  5:25 UTC (permalink / raw)
  To: zsh-workers

Invoking `whence -wa` with multiple arguments, where one does not exist,
has different results depending upon whether the non-existing one is
first in the list or not.

% PS1='%?%# '
0% whence -wa ls foo echo
ls: command
echo: builtin
echo: command
0% whence -wa foo ls echo
foo: none
ls: command
echo: builtin
echo: command
1% whence -wa ls echo foo
ls: command
echo: builtin
echo: command
0%

If I use `whence -a` then it _always_ ignores the non-existent foo.

If I use `whence -w` then it _always_ reports `foo: none` and exits 1.

It's when I use `whence -wa` that this only shows the "none" item (and
exits non-zero) when the item is first.

Built zsh at head (no local patches) to confirm this is still current:

    typeset ZSH_VERSION=5.9.0.1-dev
    typeset ZSH_PATCHLEVEL=pdp/master/zsh-5.9-209-g88eeade0b

-Phil


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug: whence -wa / none / argv position
  2023-05-27  5:25 bug: whence -wa / none / argv position Phil Pennock
@ 2023-06-24  1:55 ` Bart Schaefer
  2023-07-10 23:26   ` Phil Pennock
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2023-06-24  1:55 UTC (permalink / raw)
  To: zsh-workers

On Fri, May 26, 2023 at 10:25 PM Phil Pennock
<zsh-workers+phil.pennock@spodhuis.org> wrote:
>
> Invoking `whence -wa` with multiple arguments, where one does not exist,
> has different results depending upon whether the non-existing one is
> first in the list or not.

Is it really this easy?

diff --git a/Src/builtin.c b/Src/builtin.c
index e4f356803..669a47092 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -4046,6 +4046,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
     /* Take arguments literally -- do not glob */
     queue_signals();
     for (; *argv; argv++) {
+    informed = 0;
     if (!OPT_ISSET(ops,'p') && !allmatched) {
         char *suf;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: bug: whence -wa / none / argv position
  2023-06-24  1:55 ` Bart Schaefer
@ 2023-07-10 23:26   ` Phil Pennock
  0 siblings, 0 replies; 3+ messages in thread
From: Phil Pennock @ 2023-07-10 23:26 UTC (permalink / raw)
  To: zsh-workers

On 2023-06-23 at 18:55 -0700, Bart Schaefer wrote:
> On Fri, May 26, 2023 at 10:25 PM Phil Pennock
> <zsh-workers+phil.pennock@spodhuis.org> wrote:
> >
> > Invoking `whence -wa` with multiple arguments, where one does not exist,
> > has different results depending upon whether the non-existing one is
> > first in the list or not.
> 
> Is it really this easy?

Yes, it appears so.  Works for me.

Thanks,
-Phil


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-10 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-27  5:25 bug: whence -wa / none / argv position Phil Pennock
2023-06-24  1:55 ` Bart Schaefer
2023-07-10 23:26   ` Phil Pennock

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).