mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
To: Joe Peterson <joe@skyrush.com>,
	Alan Cox <alan@lxorguk.ukuu.org.uk>,
	LKML <linux-kernel@vger.kernel.org>
Cc: kosaki.motohiro@jp.fujitsu.com
Subject: [BUG?] tty doesn't handle ^D at cooked/non-cooked switching corner case
Date: Tue, 30 Dec 2008 21:00:23 +0900 (JST)	[thread overview]
Message-ID: <20081230201932.128D.KOSAKI.MOTOHIRO@jp.fujitsu.com> (raw)

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;







             reply	other threads:[~2008-12-30 12:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-30 12:00 KOSAKI Motohiro [this message]
2008-12-30 13:44 ` Alan Cox
2009-01-03  0:34   ` KOSAKI Motohiro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081230201932.128D.KOSAKI.MOTOHIRO@jp.fujitsu.com \
    --to=kosaki.motohiro@jp.fujitsu.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=joe@skyrush.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®