From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 23991 invoked from network); 12 Sep 2020 08:49:42 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 12 Sep 2020 08:49:42 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20200801; t=1599900583; b=UPFAWB2VyfXlh3RNIWHZ3pfhbzcD0kS2eXDpusEVg1sffzNv9mlyni1nQvfe5pirTh8V2bnepx PQXyZjrVpW0GY8FWI/m+dyPlBoQz292xlaO2VECV3lSpB6N5Xd3MabEsNCqyjW3JUjtgQ/zI31 XKM2wB10/y6WOBpKXd0T8DpnFNuxgAVyPsk3RjSGNDiJFaCQTKFyJx3ivn1+MdAW/JM3QtNWmO YYhe0MD+uOYHmeFmX+y5k1qik+syc/t+81W76qfMgnwLTRq7q2I/wYKs8HzSNeC8RwhegJmcBW c7wmMG7xXMG/ZlUDjl2VEF+72U5Jq8uUwdukbSInCdO8FQ==; ARC-Authentication-Results: i=1; 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20200801; t=1599900583; bh=CdFDYq8gdbOmp7mjTG4P+gS8u6K+7lmikQCiwJry7T0=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:DKIM-Signature:DKIM-Signature; b=Mbkis09BRzXKGFO8Nv67VbH10gxj7v4ZfbZ9f4Uj0g3WyCvgr/gkQbkpoE3UlfY2eKRPUkGqqT 3EUdpqOJxyTZGXYe608uy33G0Kcr8Kg9BLb/Zg83OnzXRY/12a1Zq91kS6gq99VaxmuBpwO8l3 h/3biLJASKSMkv0QFWGYV28KLZ8Uci/6+VLqCiC7pvd51YCkmo/cwnRjnFoW30AHDKqUB8flhF Ii8lrAUAxtv64C2ndIhZ56hlAyOagaKKd4rOUORLHyahF3mh4CIzoqvMjGgRlTrzw7XALAN8+x i9UoDhBRUFt2s/7gj+gj4UMwHlg4pT0jvJfdG/M5JrEA0g==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20200801; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Type:Cc:To:Subject:Message-ID :Date:From:In-Reply-To:References:MIME-Version:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=b4Y2hOwby+jHZJ3ESkdC0qWojygY1g4U89k75CJlAYU=; b=iQPAtnnX+xC4ZIWIZqU3EWOlbH G5SLzHdlEmceODMDEL0tlhFgevuvDk31vGS2B9Ym4YecNVhOJ3eOJgwI2r1aXrHb0YytRTqJsEXSI 2BiHUbzkyJ98Z5M8b9ea8t2WoiWL1yN/16zn3YEZr9izuyZPiMYc67JxMMl49ALwwickPaxFVSI2U Nuk1eGxi3ze/lmA3Kfx6+nAsSmktLasv75FMQLQBf7jjEqX/WNrP94jueIa5HZ4Y+/82RRulE5JbK Qe13kL+5nSAe+q06e0mPrCOqvBX7zNhBUBi3knY0Pg7DLUKpU4IT2z/orTgry5SLNNm9k2KFj+EK8 P+w9T9jg==; Received: from authenticated user by zero.zsh.org with local id 1kH1E3-0006R5-Ft; Sat, 12 Sep 2020 08:49:39 +0000 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 Received: from mail-io1-f50.google.com ([209.85.166.50]:40954) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_128_GCM_SHA256:128) id 1kH1Di-0006HV-1V; Sat, 12 Sep 2020 08:49:19 +0000 Received: by mail-io1-f50.google.com with SMTP id j2so13555402ioj.7 for ; Sat, 12 Sep 2020 01:49:17 -0700 (PDT) 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b4Y2hOwby+jHZJ3ESkdC0qWojygY1g4U89k75CJlAYU=; b=nfPI18DC+UZTlgwPYNDR+erdfw4tlvdax6DprAR8xoZOumPYdSdqYI53V+uGIqteJq hPdQOkt5Ji7XG+lxtF6WfpswS2qytuQrK7+328fSP0akkj/V+RLfU3I4u5OFOqUolzoN 4nzZcs+2FceJqZnPq1AosrWlHtprMp9VwbniGFkhsjAjZxDW3vjSx8Z9u6qOQj6r3v6j X+ZU/HqKeD4urVqWN+ul09y2fz1tSywdM1R70DbYrw+GYfpJ+/om24cbOZZoRsKg2fu9 7iKSHjZ29SeITFODJS4MOBqQr/o8Cb0uA15UZI/O62xQRyAXvNRYeq75af3nRXRjfYDy tYdQ== X-Gm-Message-State: AOAM533/ctjf7X6Vh9l2VzpjZI7x6XmEu7mPLoJctSHM2MtHxM8yi3Kv s9DS1g3FOIrVQ4JzpEPpIhYz3syAYuWO63J49IVq/JdpbGBtP6X6 X-Google-Smtp-Source: ABdhPJxG+N/EKeCPNYPfax//mUi1Ffutprfas9UH++B1JkhRL9/uNKScD4CHvfvXg+gmn1HyJckBgdA8ZG4jGWTp7CE= X-Received: by 2002:a5d:8755:: with SMTP id k21mr4831933iol.142.1599900556636; Sat, 12 Sep 2020 01:49:16 -0700 (PDT) MIME-Version: 1.0 References: <20200911144852.GA1669764@fullerene.field.pennock-tech.net> <20200911161000.GA1679994@fullerene.field.pennock-tech.net> In-Reply-To: From: Roman Perepelitsa Date: Sat, 12 Sep 2020 10:49:05 +0200 Message-ID: Subject: Re: Possible bug: HASH_CMDS has no observable effect To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset="UTF-8" X-Seq: 47374 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: Archived-At: On Sat, Sep 12, 2020 at 10:35 AM Bart Schaefer 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.