Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: symlink chain.



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.



Messages sorted by: Reverse Date, Date, Thread, Author