On Wed, Aug 19, 2009 at 12:07:29AM +0200, Roland Mainz wrote:
> Jonathan Adams wrote:
> > On Tue, Aug 18, 2009 at 04:25:01PM +0200, Roland Mainz wrote:
> > > Vladimir Kotal wrote:
> > > > Roland Mainz wrote:
> > > > > Can anyone review the patch in
> > > > > http://cr.opensolaris.org/~gisburn/cr_6712500_nightly_use_ksh93_001/ ,
> > > > > please ?
> > > > >
> > > > > The basic changes are:
> > > > > - Switch the shell interpreter from ksh88 to ksh93
> > > >
> > > > I see there is no -p option used anymore with ksh93. Is this the default
> > > > behavior in ksh93 ?
> > >
> > > The option isn't needed for Solaris 10's ksh88 either...
> > 
> > It's important, because it skips processing .profile.
> 
> ~/.profile and /etc/profile is only for login shells (both interactive
> and non-interactive) and not for scripts. IMO it's a bug if a shell in
> script mode starts to source such profile scripts (and AFAIK neither
> Solaris 10's /usr/bin/ksh nor ksh93 do that).

It's also required if you have a setuid script, right?

And on ksh88:

% truss -t open ksh -p
open("/var/ld/ld.config", O_RDONLY)             Err#2 ENOENT
open("/lib/libc.so.1", O_RDONLY)                = 3
open64(".sh_history", O_RDWR|O_APPEND|O_CREAT, 0600) = 3
$ 
% truss -t open ksh   
open("/var/ld/ld.config", O_RDONLY)             Err#2 ENOENT
open("/lib/libc.so.1", O_RDONLY)                = 3
open64(".kshrc", O_RDONLY)                      = 3
open64("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
    Received signal #18, SIGCLD [caught]
      siginfo: SIGCLD CLD_EXITED pid=101565 status=0x0000
    Received signal #18, SIGCLD [caught]
      siginfo: SIGCLD CLD_EXITED pid=101566 status=0x0000
open64("/dev/null", O_RDWR|O_APPEND|O_CREAT, 0600) = 3
$ exit

and ksh93:

% truss -t open ksh93 -p
open("/var/ld/ld.config", O_RDONLY)             Err#2 ENOENT
open("/lib/libc.so.1", O_RDONLY)                = 3
open("/proc/self/auxv", O_RDONLY)               = 3
open("/var/ld/64/ld.config", O_RDONLY)          Err#2 ENOENT
open("/lib/64/libc.so.1", O_RDONLY)             = 3
open("/usr/lib/64/libshell.so.1", O_RDONLY)     = 3
open("/usr/lib/64/libcmd.so.1", O_RDONLY)       = 3
open("/usr/lib/64/libast.so.1", O_RDONLY)       = 3
open("/lib/64/libm.so.2", O_RDONLY)             = 3
open(".sh_history", O_RDWR|O_APPEND|O_CREAT, 0600) = 3
$ exit
% truss -t open ksh93 
open("/var/ld/ld.config", O_RDONLY)             Err#2 ENOENT
open("/lib/libc.so.1", O_RDONLY)                = 3
open("/proc/self/auxv", O_RDONLY)               = 3
open("/var/ld/64/ld.config", O_RDONLY)          Err#2 ENOENT
open("/lib/64/libc.so.1", O_RDONLY)             = 3
open("/usr/lib/64/libshell.so.1", O_RDONLY)     = 3
open("/usr/lib/64/libcmd.so.1", O_RDONLY)       = 3
open("/usr/lib/64/libast.so.1", O_RDONLY)       = 3
open("/lib/64/libm.so.2", O_RDONLY)             = 3
open("/usr/bin/.paths", O_RDONLY)               Err#2 ENOENT
open("/usr/sbin/.paths", O_RDONLY)              Err#2 ENOENT
open("/usr/ccs/bin/.paths", O_RDONLY)           Err#2 ENOENT
open("/usr/sfw/bin/.paths", O_RDONLY)           Err#2 ENOENT
... more .paths ...
open("/opt/teamware/bin/.paths", O_RDONLY)      Err#2 ENOENT
open("/etc/ksh.kshrc", O_RDONLY)                = 3
open(".kshrc", O_RDONLY)                        = 3
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
open("/dev/null", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
    Received signal #18, SIGCLD [caught]
      siginfo: SIGCLD CLD_EXITED pid=101571 status=0x0000
    Received signal #18, SIGCLD [caught]
      siginfo: SIGCLD CLD_EXITED pid=101572 status=0x0000
open("/usr/bin/.paths", O_RDONLY)               Err#2 ENOENT
... more .paths ...
open("/opt/teamware/bin/.paths", O_RDONLY)      Err#2 ENOENT
open("/dev/null", O_RDWR|O_APPEND|O_CREAT, 0600) = 3
    Received signal #18, SIGCLD [caught]
      siginfo: SIGCLD CLD_EXITED pid=101573 status=0x0000
jwad...@norton:~$ exit

So it certainly looks like -p stops ksh from looking at a huge number of files
and doing a bunch of unnecessary processing.

Cheers,
- jonathan

_______________________________________________
opensolaris-code mailing list
opensolaris-code@opensolaris.org
http://mail.opensolaris.org/mailman/listinfo/opensolaris-code

Reply via email to