nickson@comp.vuw.ac.nz (Ray Nickson) (09/04/89)
The following bug which I reported in version 1.02 does not seem to have gone away in 1.03. From: Ray Nickson <nickson@comp.vuw.ac.nz> Date: Fri, 25 Aug 89 11:07:10 +1200 If I execute a shell script for which I have execute permission, but which does not start with #!, bash runs it itself (via a recursive call on main() !!). This is fine, except that if the parent bash is a login shell, so is the forked child, and it runs .profile. I was burned by this when I included `. ~/.bashrc' in my .profile; one of the commands that .bashrc ran was a script ... (my solution was simply to start using a .bash_profile instead). Any reason not to just zero the login_shell variable and remove the - from argv[0] before calling main()? You might also want to act_like_sh in this case (if you don't already) - does this have any impact other than on what startup files are run? -rgn -- Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand nickson@comp.vuw.ac.nz ...!uunet!vuwcomp!nickson + 64 4 721000x8593
bfox@AUREL.CALTECH.EDU (Brian Fox) (09/04/89)
Date: Mon, 04 Sep 89 13:10:57 +1200
From: Ray Nickson <nickson@comp.vuw.ac.nz>
The following bug which I reported in version 1.02 does not seem to have
gone away in 1.03.
From: Ray Nickson <nickson@comp.vuw.ac.nz>
Date: Fri, 25 Aug 89 11:07:10 +1200
If I execute a shell script for which I have execute permission, but
which does not start with #!, bash runs it itself (via a recursive
call on main() !!). This is fine, except that if the parent bash is a
login shell, so is the forked child, and it runs .profile. I was
burned by this when I included `. ~/.bashrc' in my .profile; one of
the commands that .bashrc ran was a script ... (my solution was simply
to start using a .bash_profile instead).
Any reason not to just zero the login_shell variable and remove the -
from argv[0] before calling main()? You might also want to
act_like_sh in this case (if you don't already) - does this have any
impact other than on what startup files are run?
-rgn
--
Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand
nickson@comp.vuw.ac.nz ...!uunet!vuwcomp!nickson + 64 4 721000x8593
Are you sure? I am sure that this is not the case.
Briannickson@comp.vuw.ac.nz (Ray Nickson) (09/05/89)
From: bfox@aurel.caltech.EDU
Date: Mon, 4 Sep 89 00:35:14 PDT
Date: Mon, 04 Sep 89 13:10:57 +1200
From: Ray Nickson <nickson@comp.vuw.ac.nz>
The following bug which I reported in version 1.02 does not seem to have
gone away in 1.03.
From: Ray Nickson <nickson@comp.vuw.ac.nz>
Date: Fri, 25 Aug 89 11:07:10 +1200
If I execute a shell script for which I have execute permission, but
which does not start with #!, bash runs it itself (via a recursive
call on main() !!). This is fine, except that if the parent bash is a
login shell, so is the forked child, and it runs .profile.
[ ... ]
Are you sure? I am sure that this is not the case.
Brian
Unless I'm doing something very wrong, it is still the case.
I removed my .bash_profile and my .bashrc.
.profile contains only the line
echo "running .profile"
and /bin/true is
exit 0
Then I get
bash$ bash-1.03 -login
running .profile
bash$ type true
true is /bin/true
bash$ true
running .profile
logout
If I change .profile to
echo "running .profile, SHLVL=" $SHLVL
true
Then I get
bash$ bash-1.03 -login
running .profile, SHLVL= 2
bash$ type true
true is hashed (/bin/true)
bash$ true
running .profile, SHLVL= 3
running .profile, SHLVL= 4
running .profile, SHLVL= 5
.. etc.
I do not know where `logout' comes from in the first case nor why the
profile does not run recursively as soon as I type bash-1.03 -login in
the second case.
bash-1.03 is GCC compiled on an HP300 running More/BSD, and I can
reproduce the problem in a similar way in 1.02 on a Sun3/80 running
SunOS4.
-rgn
--
Ray Nickson, Dept. Comp. Sci., Victoria University of Wellington, New Zealand.
nickson@comp.vuw.ac.nz ...!uunet!vuwcomp!nickson + 64 4 721000x8593