Subject: Re: kern/31572: [dM] tty MIN>1 TIME>0 O_NONBLOCK spins
To: None <gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-bugs
Date: 10/13/2005 11:30:19
On Oct 13,  3:59am, mouse@Rodents.Montreal.QC.CA (der Mouse) wrote:
-- Subject: kern/31572: [dM] tty MIN>1 TIME>0 O_NONBLOCK spins

| >Number:         31572
| >Category:       kern
| >Synopsis:       When MIN>1 TIME>0, poll() on tty succeeds but read EAGAINs
| >Confidential:   no
| >Severity:       serious
| >Priority:       low
| >Responsible:    kern-bug-people
| >State:          open
| >Class:          sw-bug
| >Submitter-Id:   net
| >Arrival-Date:   Thu Oct 13 03:59:00 +0000 2005
| >Originator:     der Mouse
| >Release:        NetBSD 2.0, also present in 1.4T, probably others
| >Organization:
| 	Dis-
| >Environment:
| 	First seen on 1.4T sparc.  Tested present on 2.0 i386.  Code
| 	inspection makes me suspect it's still present in -current.
| >Description:
| 	On a tty (tested only on pseudo-ttys, but code inspection makes
| 	me think it applies to all ttys), when c_cc[VMIN] > 1 and
| 	c_cc[VTIME] > 0 (and ICANON is off), and non-blocking I/O is
| 	turned on, then poll() returns indicating readable as soon as
| 	one character is typed, but a read returns showing EWOULDBLOCK
| 	until VMIN characters have been received.  (Presumably if
| 	non-blocking I/O were turned off, read would block instead,
| 	which is also wrong but not quite as noisily so.)
| 
| 	I've marked this as serious/low, serious because it is fairly
| 	serious for poll and read to disagree like this, but low
| 	because it obviously doesn't break much or it would have been
| 	found and fixed long ago.
| >How-To-Repeat:
| 	Try the above conditions.  Here's a test program.  Compile it
| 	(no particular options needed for me on 2.0 i386 or 1.4T sparc)
| 	and run it with no arguments.  Type a character and watch the
| 	flood of dots (type a second character to end it; interrupting
| 	it may leave your tty state hosed).

Isn't that because VTIME expires? linux is behaving the same way.

christos