zsh-workers
 help / color / mirror / code / Atom feed
From: Stefan Schmidt <Stefan.Schmidt@gmx.de>
To: zsh-workers@zsh.org
Subject: whence not behaving as expected with noaliases set
Date: Sun, 23 Oct 2022 20:31:58 +0200	[thread overview]
Message-ID: <trinity-79c2b1d1-c907-48b5-ba61-26c0c72b7b6f-1666549918615@3c-app-gmx-bap60> (raw)

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


             reply	other threads:[~2022-10-23 18:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-23 18:31 Stefan Schmidt [this message]
2022-11-21  1:45 ` Matthew Martin
2022-11-21  5:14   ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-79c2b1d1-c907-48b5-ba61-26c0c72b7b6f-1666549918615@3c-app-gmx-bap60 \
    --to=stefan.schmidt@gmx.de \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).