tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/47597: local and $() don't play well with each other
On Fri, Mar 01, 2013 at 04:45:19AM +0700, Robert Elz wrote:
> | Furthermore, this means that the behavior of an
> | external utility and the behavior of the same made as a function will be
> | different.
>
> Yes, it does, and this is a problem, yet it seems to be intentional in 2.9.5
> (and from people who know from the opengroup list/newsgroup seems to have been
> intended because of how existing shells were implemented).
>
> On the other hand, this contradicts 4.20 which requires that (aside from
> using tricks) there should be no way to detect whether a command is
> implemented as a function, built-in, or utility (note the special built-ins
> are not included in this relationship).
>
> [Tricks mean things like measuring performance, and inferring whether a
> command is built-in or a utility from how fast it runs, or knowing the
> command search rules and inserting a script with the name of the command
> being tested in a directory at the start of $PATH - if the script is executed,
> then the command is a utility, if it is not, then it would be a function
> of built-in.]
The last one is allowed for, somewhere it says that the builtin version
should only be used if the one that would be executed (after searching
$PATH) is the one in the standard place.
Netbsd's /bin/sh doesn't do that check - I don't know if any other shells do.
It would remove a big chunk of the speed benefit of running the builtin.
David
--
David Laight: david%l8s.co.uk@localhost
Home |
Main Index |
Thread Index |
Old Index