Bash chokes up on the tty mode when it terminates.

Christopher Faylor
Wed Aug 22 19:39:00 GMT 2001

On Thu, Aug 23, 2001 at 04:13:13AM +0900, Kazuhiro Fujieda wrote:
>I found bash choked up on the tty mode when it terminated.
>I tested it on NT4 Sp6a with recent nightly snapshots and the
>latest CVS source. The concrete procedure is:
>1. Insert `set CYGWIN=tty' into the cygwin.bat.
>2. Start Cygwin Bash Shell
>3. Exit immediately from it.
>The strace log attached below shows it choked up just after
>it invoked kill_pgrp.

I believe that I've fixed this.  It was caused by Corinna's recent
changes to report a reasonable value when asking how many fds cygwin
can open.

The problem is that bash calls dup2 with the value it gets from
getdtablesize as the second argument.  Then dup2 aborted because the fd
was not within range -- which it shouldn't have done.  I added code
(from a net contributor, I believe) to cause dup2 to extend the fd table
as needed last year but I neglected to eliminate a prior bounds checking
test just before it.

Anyway, I checked in a trivial fix.


More information about the Cygwin-developers mailing list