Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261873AbVBPDMw (ORCPT ); Tue, 15 Feb 2005 22:12:52 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261890AbVBPDMw (ORCPT ); Tue, 15 Feb 2005 22:12:52 -0500 Received: from scrub.xs4all.nl ([194.109.195.176]:57515 "EHLO scrub.xs4all.nl") by vger.kernel.org with ESMTP id S261873AbVBPDMu (ORCPT ); Tue, 15 Feb 2005 22:12:50 -0500 Date: Wed, 16 Feb 2005 04:12:34 +0100 (CET) From: Roman Zippel X-X-Sender: roman@scrub.home To: Linus Torvalds cc: Andreas Schwab , linux-kernel@vger.kernel.org Subject: Re: Pty is losing bytes In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1437 Lines: 40 Hi, On Tue, 15 Feb 2005, Linus Torvalds wrote: > > I've also seen more than one byte missing. For example when sending a big > > chunk of bytes down the pty via an Emacs *shell* buffer up to 16 bytes are > > missing somewhere in the middle. > > If it's NTTY (and I'm pretty certain it is - the generic tty code looks > fine, the pty code itself is too simple for words), then I'd actually have > expected more variability than a simple off-by-one. The patch below seems to do the trick too. It seems the initial receive_room() call in pty_write() returns N_TTY_BUF_SIZE and receive_buf() will happily drop the last byte. bye, Roman n_tty.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-) Index: linux-2.6/drivers/char/n_tty.c =================================================================== --- linux-2.6.orig/drivers/char/n_tty.c 2005-02-16 03:53:53.000000000 +0100 +++ linux-2.6/drivers/char/n_tty.c 2005-02-16 03:56:39.000000000 +0100 @@ -863,7 +863,7 @@ static int n_tty_receive_room(struct tty * characters will be beeped. */ if (tty->icanon && !tty->canon_data) - return N_TTY_BUF_SIZE; + return N_TTY_BUF_SIZE - 1; if (left > 0) return left; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/