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 11:10 PM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
>
> 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
> [...]
> If you unset HASH_DIRS you might get what you want.

I can confirm that unsetting HASH_DIRS makes HASH_CMDS behave as I
expect. That is, after a successful invocation of rsync,
rsync=/usr/bin/rsync gets hashed.

This implies that invoking any non-existing command with HASH_DIRS set
effectively disables HASH_CMDS. The following test confirms it:

  % sudo docker run -e TERM -it --rm zshusers/zsh:5.8
  # does-not-exist
  zsh: command not found: does-not-exist
  # apt-get update && apt-get install -y rsync
  # rsync
  rsync  version 3.1.2  protocol version 31
  # print $+commands[rsync]
  0

Do I understand it correctly that this is working as intended? It
appears to contradict the documentation for HASH_CMDS, which states
that commands are hashed when they are invoked for the first time.

Roman.




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