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
Created attachment 160351 [details, diff] Patch to fix the race condition (stop parent from stealing child session leader status)
added to bash-3.2_p48-r1