From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20546 invoked by alias); 3 Jan 2015 05:03:50 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19676 Received: (qmail 22509 invoked from network); 3 Jan 2015 05:03:47 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=b6gFOWC0 c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=-8IQQigrEPAdwNbH_mQA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150102210337.ZM22099@torch.brasslantern.com> Date: Fri, 02 Jan 2015 21:03:37 -0800 In-reply-to: <54A740F3.4040902@eastlink.ca> Comments: In reply to Ray Andrews "Re: symlink chain." (Jan 2, 5:08pm) References: <549E3A7B.9010209@eastlink.ca> <20150102170307.7d2e644a@ntlworld.com> <54A6E6B1.6070201@eastlink.ca> <20150102212422.3a761af5@ntlworld.com> <54A7136C.1060102@eastlink.ca> <20150102222140.1303a633@ntlworld.com> <54A72CEF.9090102@eastlink.ca> <54A740F3.4040902@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: symlink chain. MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 2, 5:08pm, Ray Andrews wrote: } Subject: Re: symlink chain. } } Needless to say, I have no idea if this is sound, however: } } /* With -m option -- treat arguments as a glob patterns */ } // if (OPT_ISSET(ops,'m')) { } if (OPT_ISSET(ops,'m') && **argv != '/' ) { } } ... seems to work. I wouldn't use the word "work" exactly. All that does is turn off the pattern matching entirely. You're probably next going to complain that % whence -m /\*/bin/zsh should return /usr/bin/zsh and /usr/local/bin/zsh, or somthing of the kind. This is just abusing the purpose of "whence", which is intended to tell you what a path search would find for a simple command name. If we *really* want this behavior -- which I submit that we don't, as we're wandering into silly territory like whence -m '*bin*' returning all commands in all directories named "bin", so we should stop futzing around with "whence" -- then the correct thing is rewriting the hash table scan to look at both the keys and the values when doing the pattern matching. Which has ramifications beyond "whence" because it uses the same hash table scan routines as everything else. I confess I'm actually a bit surprised that PWS was willing to hack up something as deeply involved in the internals as xsymlinks() [in which we just finished fixing other obscure bugs] in order to implement whence -S. Shell functions exist so that if something like whence doesn't do what you want, you can write something else that does.