On Fri, May 13, 2022 at 05:02:25AM -0400, Michael Orlitzky wrote:
> On Fri, 2022-05-13 at 09:11 +0200, Ulrich Mueller wrote:
> > 
> > So, should we join the "which hunt", with the goal of removing
> > sys-apps/which from the system set and from stage1?
> 
> Yes, although I would suggest "command -v" as a POSIX replacement that
> can be sent upstream. The "type" utility is also standard, but the "-p"
> flag is not, so "type -p" creates some pointless bashisms. Both are
> built-in to bash so there's no performance penalty in ebuilds either
> way.

fwiw both command -v and type -p aren't analogous to which given they
check shell functions too, requiring to pay attention to namespace.

e.g. if have /bin/ftest and ftest() { :; }, with bash:
        which ftest: /bin/ftest
        command -v ftest: ftest
        type -p ftest: (nothing)
        type -P ftest: /bin/ftest

If the function is unset they all return /bin/ftest though. In bash
/ ebuilds I don't see much reason to use command -v, but if swapping
which for command -v with POSIX sh should check if the script doesn't
have simple function names everywhere.

-- 
ionen

Attachment: signature.asc
Description: PGP signature

Reply via email to