David Korn wrote:
> 
> cc: roland.mainz at nrubsig.org
> Subject: Re: Re: [ksh93-integration-discuss] [Bug 399] New: "alias.sh"  
> mayexecute the wrong command
> --------
> 
> > Erm... the name "alias.sh" may be a bit misleading in this case: The
> > script is not the "alias.sh" script from the ksh93 test suite, it's an
> > Solaris OS/Net-specific script which "maps" a physical file like
> > /usr/bin/kill to the ksh/ksh93 "kill" builtin (take a look at
> > /usr/bin/kill on a Solaris machine - it's a shell script which calls the
> > /usr/bin/ksh "kill" builtin).
> > The problem is that if a builtin like "kill" (<--- example!!) is bound
> > to a specific path element then the original script (e.g.
> > -- snip --
> > cmd=`basename $0`
> > $cmd "$@"
> > -- snip --
> > ) ... will crawl over all elements in ${PATH} and execute the first
> > command called "kill" it finds. If the "kill" script is itself called
> > /usr/bin/kill and the path contains /usr/xpg4/bin:/usr/bin then the
> > /usr/xpg4/bin/kill command will be executed by the /usr/bin/kill script
> > instead of the (intended) "kill" builtin bound to /usr/bin/kill
> 
> If /usr/bin/kill wants to call the builtin kill, then it should
> do
>         builtin kill
> before it invokes kill.  This way kill will make to the builtin
> rather than /usr/bin/kill and there won't be a path search.

That's exactly what the new version of the alias_wrapper_thing.sh now
does... :-)
... the only additional piece is that it checks whether the requested
command is an alias or not to get things like /usr/bin/type working
(/usr/bin/type is the same wrapper script which calls the "type"
builtin... but "type" is an alias entry for "whence -v" which makes a
quick check neccesary to avoid calling "builtin" for a non-existant
"type" builtin).

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) roland.mainz at nrubsig.org
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)

Reply via email to