Bug 56551

Summary: Race in /bin/login causing loss of job control
Product: [Retired] Red Hat Linux Reporter: Itai Nahshon <itai.nahshon>
Component: util-linuxAssignee: Elliot Lee <sopwith>
Status: CLOSED DUPLICATE QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.2   
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: 2001-11-20 20:45:01 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 Itai Nahshon 2001-11-20 20:44:54 UTC
Description of Problem:
A race condition in /bin/login may cause loss of job control. This
is noticed mainly in tcsh that loses most of its interactive features.

Version-Release number of selected component (if applicable):
util-linux-2.11f-11.7.1 (in Redhat Linux 7.1 updates)
util-linux-2.11f-12     (in RedHat Linux 7.2 updates)

How Reproducible:
Always

Steps to Reproduce:
1. Telnet and login again and again until you get the problem.
2. Usually it takes me 5 to 10 attampts on an idle computer
   (686 single processor). Less on a busy SMP computer.
3. Using tcsh makes the problem more noticable.

Actual Results:
(in tcsh, immediately after login)
Warning: no access to tty (Inappropriate ioctl for device).
Thus no job control in this shell.

Then when I get the prompt I cannot use arrow keys to edit
line. When an app is running I cannot use CTRL-C or CTRL-Z
to kill or suspend the app.

Expected Results:
I expect full functionality of tcsh.

Additional Information:
See also bug #56121 which is open against tcsh.

Code (inside #ifdef USE_PAM) is calling
  ioctl(0, TIOCNOTTY, NULL);
in the parent process immediately AFTER a fork().
The child process is doing
  setsid();
  opentty(ttyn);   (really re-opening the tty)

Bahavior depends on the order in which things
happen. If the ioctl happens first things
work OK. If the ioctl comes after the open we
start tcsh without a controlling tty and hence
the problem.

Comment 1 Elliot Lee 2001-11-20 20:49:29 UTC

*** This bug has been marked as a duplicate of 54741 ***