zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Is "command" working right, yet?
Date: Tue, 11 Oct 2016 14:56:58 +0100	[thread overview]
Message-ID: <20161011145658.19c22e3a@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <7ed97993-bd95-82b8-448c-e2170603a410@inlv.org>

On Tue, 11 Oct 2016 15:40:33 +0200
Martijn Dekker <martijn@inlv.org> wrote:
> Another issue crept in: 'command -v' and 'command -V' now always act as
> if the -p option is given, i.e. they always search the default system
> PATH for external commands rather than the current one.

They are assuming -p is set, yes.

pws

diff --git a/Src/builtin.c b/Src/builtin.c
index a274ff7..8b8b217 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3663,7 +3663,7 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 		returnval = 1;
 	    }
 	    popheap();
-	} else if (func == BIN_COMMAND &&
+	} else if (func == BIN_COMMAND && OPT_ISSET(ops,'p') &&
 		   (hn = builtintab->getnode(builtintab, *argv))) {
 	    /*
 	     * Special case for "command -p[vV]" which needs to
@@ -3671,7 +3671,9 @@ bin_whence(char *nam, char **argv, Options ops, int func)
 	     */
 	    builtintab->printnode(hn, printflags);
 	    informed = 1;
-	} else if ((cnam = findcmd(*argv, 1, func == BIN_COMMAND))) {
+	} else if ((cnam = findcmd(*argv, 1,
+				   func == BIN_COMMAND &&
+				   OPT_ISSET(ops,'p')))) {
 	    /* Found external command. */
 	    if (wd) {
 		printf("%s: command\n", *argv);


  reply	other threads:[~2016-10-11 14:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03  0:37 Bart Schaefer
2016-02-07 15:24 ` Martijn Dekker
2016-09-25 23:31   ` Martijn Dekker
2016-09-26  3:13     ` Bart Schaefer
2016-09-26 10:56       ` Martijn Dekker
2016-09-26 17:02         ` Bart Schaefer
2016-09-27 10:08       ` Peter Stephenson
2016-09-27 12:15         ` Martijn Dekker
2016-09-28 10:30           ` Peter Stephenson
2016-09-28 18:37             ` Martijn Dekker
2016-09-29  8:55               ` Peter Stephenson
2016-10-11 13:40                 ` Martijn Dekker
2016-10-11 13:56                   ` Peter Stephenson [this message]
2016-10-11 16:20                     ` Martijn Dekker
2016-10-20 12:44                       ` Peter Stephenson
2016-10-20 13:06                         ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161011145658.19c22e3a@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).