[BUG?] tty doesn't handle ^D at cooked/non-cooked switching corner case
From: KOSAKI Motohiro
Date: Tue Dec 30 2008 - 07:00:39 EST
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;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/