mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [BUG?] tty doesn't handle ^D at cooked/non-cooked switching corner case
@ 2008-12-30 12:00 KOSAKI Motohiro
  2008-12-30 13:44 ` Alan Cox
  0 siblings, 1 reply; 3+ messages in thread
From: KOSAKI Motohiro @ 2008-12-30 12:00 UTC (permalink / raw)
  To: Joe Peterson, Alan Cox, LKML; +Cc: kosaki.motohiro

Hi tty expert,

Recently, ruby (scripting program language) developing group found
that linux doesn't handle ^D properly at cooked/non-cooked switching
corner case.

They (and I) think it isn't typical case, but scripting language vm
shouldn't hang up although script user write any crap and strange code.

They create following patch. is it right way?



reproduce way
--------------
1. run tty_test.sh (see below)
2. input any key before output "cooked"
3. input ^D, but do nothing


tty_test.sh
--------------
#!/bin/sh

exec 3<&0
cat <&3 &
pid=$!
stty -icanon
echo raw
sleep 1
stty icanon
echo cooked
wait $pid

---
 drivers/char/n_tty.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: b/drivers/char/n_tty.c
===================================================================
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1893,7 +1893,7 @@ do_it_again:
 			check_unthrottle(tty);
 		}
 
-		if (b - buf >= minimum)
+		if (b - buf >= (tty->icanon ? 0 : minimum))
 			break;
 		if (time)
 			timeout = time;







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-03  0:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-12-30 12:00 [BUG?] tty doesn't handle ^D at cooked/non-cooked switching corner case KOSAKI Motohiro
2008-12-30 13:44 ` Alan Cox
2009-01-03  0:34   ` KOSAKI Motohiro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®