Casper.Dik at Sun.COM wrote:
> >cc: ksh93-integration-discuss at opensolaris.org Peter.Memishian at Sun.COM
> >Subject: Re: Re: [ksh93-integration-discuss] [tools-discuss] ksh93 sleep
> >--------
> >
> >> Nobody knows what the problem is (it hasn't been root-caused yet), or
> >> if any of the later fixes address it, but the workaround is to remove
> >> the ksh93 /usr/bin/sleep from the system and replace with the old
> >> binary.
> >
> >I sent Roland a patch for the ~() problem trying to do ~ substitution.
> 
> I'm sponsoring that for Roland; however, one of the problems we have is the
> fact that "sleep 1" may sleep for a very long time.

Does the patch in
http://cr.opensolaris.org/~gisburn/ksh93_integration_cr_6807179_001/ fix
that problem ?

> And even with that fix, I observe that ksh93 tries to open ".paths" in
> any directory in $PATH.
> 
> This happens when we run:
> 
>         cmd=$(basename $0)
> 
> it *doesn't* happen when I run basename like this:
> 
>         basename $0
> 
> When a directory in $PATH is "remote", sleep can still sleep a long time.
> 
> Is there any reason to NOT use the following in /bin/alias?
> 
>         cmd=${0##*/}

That's not the problem - the ".paths" lookup is a feature of ksh93 to
look for directories with a "${dir}/.paths". The ksh93(1) manual page
says this about ".paths":
-- snip --
       The  shell  variable  PATH  defines the search path for the
       directory containing the  command.   Alternative  directory
       names  are  separated  by a colon (:).  The default path is
       /bin:/usr/bin: (specifying /bin, /usr/bin, and the  current
       directory  in  that  order).   The current directory can be
       specified by two or more adjacent colons, or by a colon  at
       the beginning or end of the path list.  If the command name
       contains a /, then the search path is not used.  Otherwise,
       each  directory  in  the path is searched for an executable
       file of the given name that is not a directory.  If  found,
       and  if  the shell determines that there is a built-in ver
       sion of a command corresponding to a given  pathname,  this
       built-in  is invoked in the current process.  If found, and
       this directory is also contained in the value of the  FPATH
       variable,  then  this file is loaded into the current shell
       environment as if it were the argument  to  the  .  command
       except  that  only preset aliases are expanded, and a func
       tion of the given name is executed as described above.   If
       not found, and the file .paths is found, and this file con
       tains a line of the form FPATH=path  where  path  names  an
       existing  directory,  and this directory contains a file of
       the given name, then this file is loaded into  the  current
       shell  environment as if it were the argument to the . spe
       cial built-in command and a function of the given  name  is
       executed.  Otherwise, if found, a process is created and an
       attempt is made to execute the command via exec(2).

       When an executable is found,  the  directory  where  it  is
       found in is searched for a file named .paths.  If this file
       is  found  and   it   contains   a   line   of   the   form
       BUILTIN_LIB=value , then the library named by value will be
       searched for as if it were an option  argument  to  builtin
       -f,  and  if  it  contains a built-in of the specified name
       this will be executed instead of a command  by  this  name.
       Otherwise,  if this file is found and it contains a line of
       the form name=value in the first or second line,  then  the
       environment  variable  name  is  modified by prepending the
       directory specified by value to  the  directory  list.   If
       value  is  not  an  absolute directory, then it specifies a
       directory relative to the directory that the executable was
       found.   If  the environment variable name does not already
       exist it will be added to  the  environment  list  for  the
       specified command.
-- snip --

AFAIK I can get rid of the PATH walk...

> I also noticed that ksh93 tries to readlink("/proc/<pid>/exe").  In
> Solaris, this can be found through "/proc/self/path/a.out" or
> using getexecname().

Should we fix this now or with the ksh93-integration update2 putback ?

----

Bye,
Roland

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

Reply via email to