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

Re: symlink chain.

On Jan 2, 2015, at 1:42 PM, Ray Andrews <rayandrews@xxxxxxxxxxx> wrote:

> Do you think 'whence' would benefit from showing the chain if '-s' is specified? Maybe it's just me, but I want no surprises when I use whence, I want complete information about what any typed command it actually going to end up executing and a roadmap of any and all links as to how it got there.

I would consider this undesirable noise, and I think most users would agree. The point of `whence` is to "indicate how [the argument] would be interpreted if used as a command name". I don't care about the chain of links, I just want to know what ends up being run.

> Again, maybe it's only me, but when I first started using the development builds, I was never sure what the hell was actually going on because I have three 'zsh' on my path, each of which is a chain of links going hither and yon pointing to various and sundry binaries all over the place.  Only once I untangled these Gordian Knots could I end up with this:
>   $ whence -masv "zsh"
>   zsh-5.0.7-165-g2194da1
>   zsh is /usr/local/bin/zsh -> /usr/local/bin/zsh-5.0.7-165-g2194da1
>   zsh is /usr/bin/zsh -> /usr/local/bin/zsh-5.0.7-165-g2194da1
>   zsh is /bin/zsh -> /usr/local/bin/zsh-5.0.7-165-g2194da1
> ... so I actually know what the heck is happening. (And when Debian breaks it, I can fix it fast.)

That's fine, but it's easy enough for you to write a script or function that accomplishes what you need. It's not worth increasing complexity for everyone else.

> BTW, how is it that both your method and 'namei' show paths except for the final binary target, whereas the 'whence' output just above shows all paths including for the final binary?  Consistency is not a zsh virtue.

It looks like `showlinkchain` and `namei` just display link targets, which are often relative paths. `whence` resolves the targets to an absolute path, as befits its purpose.


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