[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug, feature or just the correct behaviour (stat'ing -bash down the
From: |
Chet Ramey |
Subject: |
Re: Bug, feature or just the correct behaviour (stat'ing -bash down the PATH) |
Date: |
Sat, 06 Jun 2015 15:25:48 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 |
On 6/2/15 9:08 AM, Wheatley, Martin R wrote:
> $ echo $PATH
> /usr/bin:/usr/sbin:/usr/dt/bin:/home/USER/bin
> $
>
>
> a truss of "bash -ls" shows it stat'ing '-bash' in each of the directories
> in PATH...
>
> 11933: stat64("/usr/bin/-bash", 0xFFBFEBE8) Err#2 ENOENT
> 11933: stat64("/usr/sbin/-bash", 0xFFBFEBE8) Err#2 ENOENT
> 11933: stat64("/usr/dt/bin/-bash", 0xFFBFEBE8) Err#2 ENOENT
> 11933: stat64("/home/USER/bin/-bash", 0xFFBFEBE8) Err#2 ENOENT
>
> Why does bash do all these 'stat()' system calls? We tried providing an
> executable '-bash' at one of the locations but it didn't appear to have
> any effect.
This does look like bash is setting the BASH variable, which is the full
pathname, as best as bash can figure, to the current instance of bash.
It's not always $SHELL, for obvious reasons, and not $0. This question
used to come up a lot.
The puzzling thing is the `-bash'. Current versions of bash don't add the
`-' at the beginning of the shell name, and I'm not sure older versions
did, either. You look like you're using Solaris, though, so ancient
versions are definitely possible.
> If one of the directories in the PATH is on an NFS server that is
> 'down' then bash hangs - which disables a shell which would otherwise
> be usable.
You can't mount -o intr?
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/