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 47367
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Roman Perepelitsa <roman.perepelitsa@xxxxxxxxx>
- Subject: Re: Possible bug: HASH_CMDS has no observable effect
- Date: Fri, 11 Sep 2020 10:48:52 -0400
- Archived-at: <https://zsh.org/workers/47367>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-09/20200911144852.GA1669764%40fullerene.field.pennock-tech.net>
- Authentication-results: zsh.org; iprev=pass (mx.spodhuis.org) smtp.remote-ip=94.142.241.89; dkim=pass header.d=spodhuis.org header.s=d202008e2 header.a=ed25519-sha256; dkim=pass header.d=spodhuis.org header.s=d202008 header.a=rsa-sha256; dmarc=pass header.from=spodhuis.org; arc=none
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202008; h=OpenPGP:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Reply-To:Subject:Date:To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:OpenPGP: Organization; bh=MEulw0ut3zVU2RYZAmneFk8pgVj6qELyqYqyMH2YDJU=; t=1599835739; x=1601045339; b=NHuOoTsrQ5JJt7W+hySzO2UTa4mQ3BZ1NsE2yti3Z0bwbdCIOE6HKgk5FbzO 7YkJb84OSnPh3M6YYVce9Uua4UJ98hDrG0NaYc5iN4YH6e4gCsU3sARrZyYoGUlvaYz7h838WdI6J +MzB4JNLnSQEV0BbIFXFRNyunanqgjhYRs+9h7wykF5UTssnrnBFB+R/KabCFRZvw1pj+TIPtm67F ciV/BHe3LFE84MrVfgIBagitZfJXH/AGU4vVOEQ0dstrW3k8VYDpRDUVIDAX+cfkWbXeQdGRCcUpi u/sva7OezAo2ds6fQktK0gv0NvScCKJDfASIBSq4qBdWMYrhADA==;
- Dkim-signature: v=1; a=ed25519-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d202008e2; h=OpenPGP:In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Reply-To:Subject:Date:To: Cc:Content-Transfer-Encoding:Content-ID:Content-Description:OpenPGP: Organization; bh=MEulw0ut3zVU2RYZAmneFk8pgVj6qELyqYqyMH2YDJU=; t=1599835739; x=1601045339; b=HyS5zcF1h+fJ+8dy1ZwEQ3a78A01qci9jw+UHNkcatlFXwFQ/sb56r1xokin rAzKxyaYFb9DVO98vC1OFyj3Cg==;
- In-reply-to: <CAN=4vMqM-2Vu0n+QTbA9B_9z=3DKDdiOKbDRRaGGOG2rbY7-jA@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>
- Openpgp: url=https://www.security.spodhuis.org/PGP/keys/keys-2013rsa-2020cv25519.asc
- References: <CAN=4vMqM-2Vu0n+QTbA9B_9z=3DKDdiOKbDRRaGGOG2rbY7-jA@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
On 2020-09-11 at 10:21 +0200, Roman Perepelitsa wrote:
> From the documentation for HASH_CMDS option:
>
> Note the location of each command the first time it is executed.
> Subsequent invocations of the same command will use the saved
> location, avoiding a path search. If this option is unset, no path
> hashing is done at all. However, when CORRECT is set, commands
> whose names do not appear in the functions or aliases hash tables
> are hashed in order to avoid reporting them as spelling errors.
So, if and only if CORRECT is set, then non-present commands will be
remembered as not present.
> % sudo docker run -e TERM -it --rm zshusers/zsh:5.8
> # print $options[hash_cmds]
> on
% docker run -e TERM -it --rm zshusers/zsh:5.8
7190647e021a# print $options[hash_cmds] $options[correct]
on off
7190647e021a# setopt correct
7190647e021a# print $options[hash_cmds] $options[correct]
on on
7190647e021a# rsync
zsh: correct 'rsync' to 'sync' [nyae]? n
zsh: command not found: rsync
7190647e021a# apt-get update && apt-get install -y rsync
[...]
7190647e021a# rsync
zsh: correct 'rsync' to 'sync' [nyae]?
At that point, if you type 'n', then zsh will go ahead and try to run
rsync, and it will succeed.
You will need to run `rehash` (or whatever) before zsh will remember,
for correction purposes, that the command does exist after all.
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author