bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: posix command search and execution


From: Mike Jonkmans
Subject: Re: posix command search and execution
Date: Wed, 8 Nov 2023 23:10:40 +0100

On Wed, Nov 08, 2023 at 10:38:19AM -0500, Chet Ramey wrote:
> On 11/7/23 5:04 PM, Mike Jonkmans wrote:
> 
> It depends on your requirements. If you want something that is easy to
> explain to users, you want to reduce the distinction between `intrinsics'
> and `regular builtins' to something as small as possible. That way the
> search reduces to
> 
> special builtins*
> functions
> intrinsics
> executables
> 
> in that order, with ways to override each one (except special builtins
> in posix mode).

That is a good point.
The POSIX standard is intended for two classes of readers, implementors and
users (application writers).
If the users had anything to say, they would probably vote for the bash way.

> > >    | > 1eI) Search is successful.
> > >    | > 1eIa) Check for `regular builtins' and functions
> > >    | >       and invoke that regular builtin/function.
> > >    | >       Q: Shouldn't this specify an ordering for builtins/functions?
> > >    | The text seems to imply that you can't have both, doesn't it?
> > > While I suppose you could have both, it would be very unusual.
> > Unusuality sketch:
> > - the shell provides a builtin for a standard utility
> > - the distributor provides a function for the same utility in /etc/profile
> >    (maybe to mitigate some security issue)
> > Are scripts in /etc/profile considered part of the implementation?
> Yes. But there's no way to make a distinction between this type of function
> and any other user-supplied function, so the distinction isn't useful.

A shell could flag a function as belonging to the implementation.
Then mark all new functions as such while not done with /etc/profile.
Not that I really would like to see that happen, just for argument's sake.

> > I already can't find the definition of standard utilities.
> The standard utilities are the ones specified in the standard.

An implementor will probably know this. But a user might not.
The standard should define that.

> > >    | I think the resolution to interpretation 854 addresses this. Shells
> > >    | who want this ordering just declare all the builtins they implement 
> > > as
> > >    | `intrinsic' so they're not subject to a PATH search.
> > > Yes.
> > Can this intrinsic list be amended with any user loaded builtins?
> You mean enable -f? It's up to the shell implementation. Bash treats
> dynamically-loaded builtins the same as any other builtin.

That was indeed what I meant.
Does the new POSIX version with intrinsics also allow for this?


-- 
Regards, Mike Jonkmans



reply via email to

[Prev in Thread] Current Thread [Next in Thread]