]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
sh: Remove special %builtin PATH entry.
authorJilles Tjoelker <jilles@FreeBSD.org>
Sun, 9 Jan 2011 21:07:30 +0000 (21:07 +0000)
committerJilles Tjoelker <jilles@FreeBSD.org>
Sun, 9 Jan 2011 21:07:30 +0000 (21:07 +0000)
commit4b45b49a702a5d956cc3660f91656d48f5a2ff57
treedfc78a13bf1df40e16086dd9a22480b709aefe36
parent9269189f980a65bc96fe5412b564b1c6c2df3cb3
sh: Remove special %builtin PATH entry.
All builtins are now always found before a PATH search.

Most ash derivatives have an undocumented feature where the presence of an
entry "%builtin" in $PATH will cause builtins to be checked at that point of
the PATH search, rather than before looking at any directories as documented
in the man page (very old versions do document this feature).

I am removing this feature from sh, as it complicates the code, may violate
expectations (for example, /usr/bin/alias is very close to a forkbomb with
PATH=/usr/bin:%builtin, only /usr/bin/builtin not being another link saves
it) and appears to be unused (all the %builtin google code search finds is
in some sort of ash source code).

Note that aliases and functions took and take precedence above builtins.
Because aliases work on a lexical level they can only ever be overridden on
a lexical level (quoting or preceding 'builtin' or 'command'). Allowing
override of functions via PATH does not really fit in the model of sh and it
would work differently from %builtin if implemented.

Note: POSIX says special builtins are found before functions. We comply to
this because we do not allow functions with the same name as a special
builtin.

Silence from: freebsd-hackers@ (message sent 20101225)
Discussed with: dougb
bin/sh/exec.c
tools/regression/bin/sh/execution/path1.0 [new file with mode: 0644]