Red Hat Bugzilla – Bug 20126
Hang on exec
Last modified: 2008-05-01 11:37:59 EDT
My login information in the passwd file is as follows:
aric:<password>:<userID>:<groupID>:Aric D. Blumer:/us/aric:/bin/sh
I have the following in my $HOME/.profile:
This is so my version of bash is executed automatically as my shell.
When I logged in with RH62 and prior, this worked just fine.
When I log in with this setup in RH70, it hangs and I never see the bash
prompt. I have to kill the exec'ed process with a -9. /bin/sh is a link to
/bin/bash, so apparently bash is doing something strange during exec.
If I change my $HOME/.profile to this:
Then it doesn't hang.
This is actually the expected behavior:
Bash executes your shell, which inherits the environment, therefore, it's a login shell and execs your .profile, as well, causing it to exit and exec itself, causing an endless loop.
Try again. What you claim is not true for three reasons:
1) It worked just fine with RedHat 6.2
2) There is no recursive spawing of bash (see below)
3) $HOME/.profile is only being read once. See the bash man page (I have a
$HOME/.bash_profile which does not exec bash again).
The following will prove there is not recursion:
% cat ~/.profile
echo Sourcing .profile
echo Sourcing .bash_profile
% rlogin localhost
Last login: Thu Nov 2 08:47:55 from radar
You have mail.
If recursion were happening, I would see a bunch of "Sourcing .profile" on the
screen. I do not.
It is not a recursion. This also happens if you exec /bin/tcsh. The simple fix I
found was to copy /bin/bash (version 1) to /bin/sh to replace the symlink to
Fixed in 2.05-5