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

Re: Possible bug: HASH_CMDS has no observable effect



On Fri, Sep 11, 2020 at 9:33 AM Roman Perepelitsa
<roman.perepelitsa@xxxxxxxxx> wrote:
>
> Why isn't rsync hashed the first time it's executed?

This is usually because of HASH_DIRS:
              Whenever a command name is hashed, hash the directory containing
              it,  as  well as all directories that occur earlier in the path.

Once the cache has been pre-populated by hashing a directory,
HASH_CMDS stops attempting to search that directory for new additions.
A "rehash" is needed to discard the cached directory and reload any
new commands that are now contained therein.

If you unset HASH_DIRS you might get what you want.

A complication of this is that the completion system also invokes
command hashing in order to be able to use the $commands associative
array.  So if you use completion at all, you might also find that
command (re)hashing works differently than in a "zsh -f" shell.  Refer
to the description of "rehash" under "Standard Styles".




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