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 47374
- 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 10:49:05 +0200
- Archived-at: <https://zsh.org/workers/47374>
- Archived-at: <http://www.zsh.org/sympa/arcsearch_id/zsh-workers/2020-09/CAN%3D4vMr0ucdLxfb%2BGMevBVT-%3Du1oNRr%2BTc9EEVKizkeQC5tL7A%40mail.gmail.com>
- Authentication-results: zsh.org; iprev=pass (mail-io1-f50.google.com) smtp.remote-ip=209.85.166.50; 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=b4Y2hOwby+jHZJ3ESkdC0qWojygY1g4U89k75CJlAYU=; b=hcksGvCwPdUycCqIfdhbdMqhqME8IFC3oBSncCe3dyoyF+n61CDMYMPHC+OyIF3Sfk 0l+k/eqnH55QtzUaMHgUDOWfeid0GEWrxtel06CWW0Rac2O7cjR9wO/VXKmpWJKPoisP /f/19k0GhgE5wjNAEg/RciBaFK3/2Rn9ZLGBwrhsEdix891pGvXL26+aLJpKLlRW7WrC oQ6c0NHOXMGYBj2FsamBKf0DmGd2emSi7jeDktcpxw84LTpwQTwN/OLRcEQSuf1Bo+p+ +odUJSHJnQqYVQqsI94i1K1uqtAZ8Qhq0+H5QxNuDk53ZY91TS3aCzLvi2tNvkqSVt0+ eqkg==
- In-reply-to: <CAH+w=7YDbOLz8Vp9v1tuweX9rGynS19GQ3FDiSryvqX=iz2sNA@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> <CAN=4vMrC2QjfxWaPUE9QS9tENBu=7BB=Hmp5rY6SaFahFThq=Q@mail.gmail.com> <CAH+w=7YDbOLz8Vp9v1tuweX9rGynS19GQ3FDiSryvqX=iz2sNA@mail.gmail.com>
- Sender: zsh-workers-request@xxxxxxx
On Sat, Sep 12, 2020 at 10:35 AM Bart Schaefer
<schaefer@xxxxxxxxxxxxxxxx> wrote:
> This eliminates the search
> overhead for any external command you might use in the future. In
> order to avoid the expense of a useless search when for example you
> make a typo, the assumption is made that if the command is not already
> in the cache then it must not be in any part of the path that has
> previously been searched. The whole search-and-cache process is
> short-circuited.
Doesn't this search happen anyway? When I type `rsync`, it gets
resolved as /usr/bin/rsync and gets executed. This requires searching
for rsync in all path directories. I believe this is done in execute()
in Src/exec.c. Wouldn't it be better to search for `rsync` in the
parent shell (before forking) and hash the result? This would make the
behavior of HASH_CMDS match the documentation (and my intuition),
would make the invocation of newly installed commands faster, and
wouldn't slow anything down. Am I missing something?
Roman.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author