Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Possible bug: HASH_CMDS has no observable effect
- X-seq: zsh-workers 47372
- From: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Possible bug: HASH_CMDS has no observable effect
- Date: Sat, 12 Sep 2020 09:02:09 +0200
- Archived-at: <https://zsh.org/workers/47372>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-09/CAN%3D4vMrC2QjfxWaPUE9QS9tENBu%3D7BB%3DHmp5rY6SaFahFThq%3DQ%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-il1-f172.google.com) smtp.remote-ip=209.85.166.172; dkim=pass header.d=gmail.com header.s=20161025 header.a=rsa-sha256; dmarc=pass header.from=gmail.com; arc=none
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CkymZ4DIvwi7EMq6+T94irDsaJl7jfLM1C7HK8L6jYA=; b=EgB+5XH0W1AeZ/fgk55dJBXmPF9HPNcq6DcFq8k9nrA32MRTPYqQe3opfGKsiRDSM3 4uE08yN/UQrfdzLlDTLY2mDOnKHCWWfXjWui1aUBxKfzX1limBFlqST4Np5YrQQbRIX3 pP6bw1jO8Yg5RZKLvrDsuSS/JFqWO2EvTpcrZ8TauYYBhwcZn/njap+KDbDKLc2Zfegu edjmFQt6QQ2doYi324G/eHe7fs4/1NCqeQe3Sei7fKwtUXkz6pavq9WAKKEInlOCoxxt 0jc6xhYi1CEhdyIknBwXbOhfDEmKDHuCznaxU60zUHsWM1xGjnsL8wrPgHbpK28FvtPr cJRw==
- In-reply-to: <CAH+w=7Y2VQpidVcinSXkQQqng0XjOwYtWL7a8jiYFx+te7fQCw@mail.gmail.com>
- List-archive: <http://www.zsh.org/sympa/arc/zsh-workers>
- List-help: <mailto:sympa@zsh.org?subject=help>
- List-id: <zsh-workers.zsh.org>
- List-owner: <mailto:zsh-workers-request@zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-subscribe: <mailto:sympa@zsh.org?subject=subscribe%20zsh-workers>
- List-unsubscribe: <mailto:sympa@zsh.org?subject=unsubscribe%20zsh-workers>
- References: <CAN=4vMqM-2Vu0n+QTbA9B_9z=3DKDdiOKbDRRaGGOG2rbY7-jA@mail.gmail.com> <20200911144852.GA1669764@fullerene.field.pennock-tech.net> <CAN=4vMrFhmKitKbdPdabZ1Ey9cjmEf62GVaGVMxn6T9AjZVc8Q@mail.gmail.com> <20200911161000.GA1679994@fullerene.field.pennock-tech.net> <CAN=4vMq-prFqopCW8apuYO8YUnuKL8G=WX+jBXFwgiFkfY=5Pw@mail.gmail.com> <CAH+w=7Y2VQpidVcinSXkQQqng0XjOwYtWL7a8jiYFx+te7fQCw@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
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