Bug 20126

Summary: Hang on exec
Product: [Retired] Red Hat Linux Reporter: Aric <aric>
Component: bashAssignee: Bernhard Rosenkraenzer <bero>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-12-08 23:33:34 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Aric 2000-10-31 22:19:55 UTC
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:
exec /us/aric/bin/linux/bash;

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:
/us/aric/bin/linux/bash;
exit;

Then it doesn't hang.

Comment 1 Bernhard Rosenkraenzer 2000-11-02 13:18:38 UTC
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.

Comment 2 Aric 2000-11-02 13:48:15 UTC
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
exec /us/aric/bin/linux/bash
%cat ~/.bash_profile
echo Sourcing .bash_profile
% rlogin localhost
Last login: Thu Nov  2 08:47:55 from radar
You have mail.
Sourcing .profile

If recursion were happening, I would see a bunch of "Sourcing .profile" on the
screen. I do not.


Comment 3 Luc Dierckx 2000-12-08 23:33:31 UTC
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
bash2.

Comment 4 Bernhard Rosenkraenzer 2001-05-23 08:15:19 UTC
Fixed in 2.05-5