Bug 20126 - Hang on exec
Hang on exec
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: bash (Show other bugs)
7.0
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Bernhard Rosenkraenzer
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2000-10-31 17:19 EST by Aric
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-12-08 18:33:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Aric 2000-10-31 17:19:55 EST
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 08:18:38 EST
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 08:48:15 EST
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 18:33:31 EST
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 04:15:19 EDT
Fixed in 2.05-5

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