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

whence not behaving as expected with noaliases set



Hello!

The documentation on whence states:

> For each name, indicate how it would be interpreted if used as a command name.
https://zsh.sourceforge.io/Doc/Release/Shell-Builtin-Commands.html

This works as expected if an alias is defined but if the `noaliases` option is set `whence` still returns the alias (same for `type`, `where` and `which`).

    $ zsh --version
    zsh 5.9 (x86_64-apple-darwin18.7.0)
    $ zsh
    % whence curl
    /usr/bin/curl
    % /usr/bin/curl --version | head -n 1 | awk '{ print $2 }'
    7.54.0
    % alias curl=/usr/local/Cellar/curl/7.85.0/bin/curl
    % whence curl
    /usr/local/Cellar/curl/7.85.0/bin/curl
    % curl --version | head -n 1 | awk '{ print $2 }'
    7.85.0
    % setopt noaliases
    % curl --version | head -n 1 | awk '{ print $2 }'
    7.54.0
    % whence curl
    /usr/local/Cellar/curl/7.85.0/bin/curl
    % type curl
    curl is an alias for /usr/local/Cellar/curl/7.85.0/bin/curl
    % where curl
    curl: aliased to /usr/local/Cellar/curl/7.85.0/bin/curl
    /usr/bin/curl
    % which curl
    curl: aliased to /usr/local/Cellar/curl/7.85.0/bin/curl

Am I misinterpreting or misunderstanding something here or is there in fact a contradiction between the documentation and the implementation?

If there is a contradiction, what would be the recommend way to resolve it?

Cheers,
Stefan




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