Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Running 'type' causes false positive hashed command completion



On Aug 24,  8:58pm, Daniel Shahaf wrote:
} Subject: Running 'type' causes false positive hashed command completion
}
} $ zsh -f
} % cd $(mtemp -d)
} % touch sudofoo; chmod +x $_
} % ./sudo<TAB>
} <becomes>
} % ./sudofoo <^C>
} % type -w ./sudo
} ./sudo: none
} % ./sudo<TAB>
} ./sudo    sudofoo*
} 
} That's wrong because ./sudo does not exist.

This seems pretty obvious:


diff --git a/Src/exec.c b/Src/exec.c
index ea9214d..9b24d38 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -772,7 +772,7 @@ findcmd(char *arg0, int docopy)
     Cmdnam cn;
 
     cn = (Cmdnam) cmdnamtab->getnode(cmdnamtab, arg0);
-    if (!cn && isset(HASHCMDS))
+    if (!cn && isset(HASHCMDS) && !isrelative(arg0))
 	cn = hashcmd(arg0, path);
     if ((int) strlen(arg0) > PATH_MAX)
 	return NULL;


Can anyone think of a valid case which that breaks?  The doc (under the
PATH_DIRS option) even says "Commands explicitly beginning with `/', `./'
or `../' are not subject to the path search."



Messages sorted by: Reverse Date, Date, Thread, Author