zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: Roman Perepelitsa <roman.perepelitsa@gmail.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Possible bug: HASH_CMDS has no observable effect
Date: Fri, 11 Sep 2020 12:10:00 -0400	[thread overview]
Message-ID: <20200911161000.GA1679994@fullerene.field.pennock-tech.net> (raw)
In-Reply-To: <CAN=4vMrFhmKitKbdPdabZ1Ey9cjmEf62GVaGVMxn6T9AjZVc8Q@mail.gmail.com>

On 2020-09-11 at 17:01 +0200, Roman Perepelitsa wrote:
> Could you clarify how this statement is related to my bug report?

Sure thing.  You quoted documentation which also covered a combination
not in effect, reported Zsh's behavior, and wrote:

} I took this to mean that after installing rsync and invoking it,
} ${commands[rsync]} will be set and running `hash` will display an
} entry for rsync. This, however, is not the case.

I explained the observed behavior, relative to the quoted documentation,
and what was going on.

> In case this wasn't clear, in my bug report the output of the
> following two commands is not what I expect:
> 
>   # print $+commands[rsync]
>   0
>   # hash | grep rsync
>   #
> 
> The expected output:
> 
>   # print $+commands[rsync]
>   1
>   # hash | grep rsync
>   rsync=/usr/bin/rsync
>   #
> 
> The reason why I expect this output is because I've invoked rsync
> right before these two commands while HASH_CMDS was in effect.

There's two issues here, and it does look to me like the docs are out of
date.

Per the documentation, the first time you invoked `rsync`, an entry was
added to the cache and thereafter when you invoked rsync, the cached
entry was used.  So the quoted examples don't make the documentation
wrong.

Except that's not what's going on, because even if rsync is installed
before you first try to run it, the same thing happens.  So it looks
like zsh is preemptively building the command hash and not remembering
when you do first run it.

If you install rsync before first trying to access it, the docs imply
that it should just work for you.  Instead, you need to `rehash` first.


Can anyone speak to whether we should change the documentation or the
behavior?  If the documentation, can someone who's not a maintainer
suggest text which is sufficiently clear to them?

-Phil


  reply	other threads:[~2020-09-11 16:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-11  8:21 Roman Perepelitsa
2020-09-11 14:48 ` Phil Pennock
2020-09-11 15:01   ` Roman Perepelitsa
2020-09-11 16:10     ` Phil Pennock [this message]
2020-09-11 16:33       ` Roman Perepelitsa
2020-09-11 21:10         ` Bart Schaefer
2020-09-12  7:02           ` Roman Perepelitsa
2020-09-12  8:35             ` Bart Schaefer
2020-09-12  8:49               ` Roman Perepelitsa
2020-09-12 20:41                 ` Bart Schaefer
2020-09-12 20:43                   ` Bart Schaefer
2020-09-13  9:31                   ` Roman Perepelitsa
2020-09-13 22:24                     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200911161000.GA1679994@fullerene.field.pennock-tech.net \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=roman.perepelitsa@gmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).