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

Re: Possible bug: HASH_CMDS has no observable effect

On Sat, Sep 12, 2020 at 10:35 AM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> This eliminates the search
> overhead for any external command you might use in the future.  In
> order to avoid the expense of a useless search when for example you
> make a typo, the assumption is made that if the command is not already
> in the cache then it must not be in any part of the path that has
> previously been searched.  The whole search-and-cache process is
> short-circuited.

Doesn't this search happen anyway? When I type `rsync`, it gets
resolved as /usr/bin/rsync and gets executed. This requires searching
for rsync in all path directories. I believe this is done in execute()
in Src/exec.c. Wouldn't it be better to search for `rsync` in the
parent shell (before forking) and hash the result? This would make the
behavior of HASH_CMDS match the documentation (and my intuition),
would make the invocation of newly installed commands faster, and
wouldn't slow anything down. Am I missing something?


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