about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCharles Blake <charlechaud@gmail.com>2019-03-16 16:01:57 -0400
committerPeter Stephenson <p.stephenson@samsung.com>2019-03-19 14:09:50 +0000
commit084bf17c4bc28a2a651c69fdc9a5bdd6473c3b04 (patch)
treeea2a86ac93a5c3b1aa670d10bf89124a052b45dd
parent73b29f079b50412700727e0f77991506c03d19fe (diff)
downloadzsh-084bf17c4bc28a2a651c69fdc9a5bdd6473c3b04.tar.gz
zsh-084bf17c4bc28a2a651c69fdc9a5bdd6473c3b04.tar.xz
zsh-084bf17c4bc28a2a651c69fdc9a5bdd6473c3b04.zip
44132: don't hash commands beginning with /
-rw-r--r--ChangeLog3
-rw-r--r--Doc/Zsh/builtins.yo4
-rw-r--r--Src/exec.c2
3 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 2196db3de..d478b3307 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-03-19  Peter Stephenson  <p.stephenson@samsung.com>
 
+	* Charles Blake: 44132: Src/exec.c, Doc/Zsh/builtins.yo: don't
+	hash commands beginning with a '/'.
+
 	* 44142: Src/hist.c: fix bug stripping spaces on line with only
 	comment.
 
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index cc9832379..a926395ad 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -988,6 +988,10 @@ The choice of hash table to work on is determined by the tt(-d) option;
 without the option the command hash table is used, and with the option the
 named directory hash table is used.
 
+Command paths starting with a tt(/) are never hashed, whether by explicit
+use of the tt(hash) command or otherwise, but are always found
+by direct look up in the file system.
+
 Given no arguments, and neither the tt(-r) or tt(-f) options,
 the selected hash table will be listed in full.
 
diff --git a/Src/exec.c b/Src/exec.c
index 042ba065a..79ef83c1e 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -940,6 +940,8 @@ hashcmd(char *arg0, char **pp)
     char *s, buf[PATH_MAX+1];
     char **pq;
 
+    if (*arg0 == '/')
+        return NULL;
     for (; *pp; pp++)
 	if (**pp == '/') {
 	    s = buf;