Bug 20126 - Hang on exec
Summary: Hang on exec
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: bash   
(Show other bugs)
Version: 7.0
Hardware: i386 Linux
medium
medium
Target Milestone: ---
Assignee: Bernhard Rosenkraenzer
QA Contact:
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2000-10-31 22:19 UTC by Aric
Modified: 2008-05-01 15:37 UTC (History)
0 users

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: ---


Attachments (Terms of Use)

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


Note You need to log in before you can comment on or make changes to this bug.