Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 231775

Summary: app-shells/bash-3.2 tty session leader (tcsetpgrp) race condition
Product: Gentoo Linux Reporter: Joe Peterson (RETIRED) <lavajoe>
Component: [OLD] Core systemAssignee: Gentoo's Team for Core System packages <base-system>
Status: RESOLVED FIXED    
Severity: normal    
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: Patch to fix the race condition (stop parent from stealing child session leader status)

Description Joe Peterson (RETIRED) gentoo-dev 2008-07-14 15:52:54 UTC
A parent bash shell sometimes will set the session leader tty (using tcsetpgrp) back to itself, taking control away from a child bash shell, due to a race condition.  A result is that the child can then not then execute some commands (like stty) from its init script (e.g. .bashrc).  The result I (and others) have seen is that the bash shell will hang while reading the init script.

As far as I know (from some old posts I've seen), this is a long-standing intermittent issue.  I reported this on the bash bug list, and I received a patch from upstream that fixes it.  Upstream says this will likely make it into bash-4.0.  I will attach the patch, in case we want to apply it in Gentoo to fix the issue in current builds.

More info is here:

http://www.nabble.com/stty-sometimes-hangs-(ERESTARTSYS-error)-when-called-from-.bashrc-td18047733.html#a18305346
Comment 1 Joe Peterson (RETIRED) gentoo-dev 2008-07-14 15:54:18 UTC
Created attachment 160351 [details, diff]
Patch to fix the race condition (stop parent from stealing child session leader status)
Comment 2 SpanKY gentoo-dev 2009-02-09 01:07:42 UTC
added to bash-3.2_p48-r1