From patchwork Tue Oct 8 17:28:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris J Arges X-Patchwork-Id: 281526 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 0F8CC2C00B9 for ; Wed, 9 Oct 2013 04:28:31 +1100 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VTb57-0007qB-Fo; Tue, 08 Oct 2013 17:28:25 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1VTb4x-0007op-U5 for kernel-team@lists.ubuntu.com; Tue, 08 Oct 2013 17:28:15 +0000 Received: from cpe-66-68-155-223.austin.res.rr.com ([66.68.155.223] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1VTb4x-0008Jw-KM for kernel-team@lists.ubuntu.com; Tue, 08 Oct 2013 17:28:15 +0000 From: Chris J Arges To: kernel-team@lists.ubuntu.com Subject: [PATCH] SAUCE: (no-up) Only let characters through when there are active readers. Date: Tue, 8 Oct 2013 12:28:13 -0500 Message-Id: <1381253293-5209-2-git-send-email-chris.j.arges@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1381253293-5209-1-git-send-email-chris.j.arges@canonical.com> References: <1381253293-5209-1-git-send-email-chris.j.arges@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Maximiliano Curia BugLink: http://bugs.launchpad.net/bugs/1208740 If there is an active reader, previous behavior is in place. When there is no active reader, input is blocked until the next read call unblocks it. This fixes a long standing issue with readline when pasting more than 4096 bytes. Signed-off-by: Chris J Arges --- drivers/tty/n_tty.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c index 72d3ff8..367259e 100644 --- a/drivers/tty/n_tty.c +++ b/drivers/tty/n_tty.c @@ -101,9 +101,16 @@ static void n_tty_set_room(struct tty_struct *tty) * pending newlines, let characters through without limit, so * that erase characters will be handled. Other excess * characters will be beeped. + * If there is no reader waiting for the input, block instead of + * letting the characters through. */ if (left <= 0) - left = tty->icanon && !tty->canon_data; + if (waitqueue_active(&tty->read_wait)) { + left = ldata->icanon && !ldata->canon_data; + } else { + left = 0; + } + old_left = tty->receive_room; tty->receive_room = left;