From: "Michael Kerrisk (man-pages)" <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Peter Hurley
<peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>,
"Dr. Tobias Quathamer"
<toddy-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
Cc: mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Daniel Shahaf <danielsh-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH] termios.3: Document line length in canonical mode
Date: Wed, 17 Feb 2016 11:09:39 +0100 [thread overview]
Message-ID: <56C446E3.2070501@gmail.com> (raw)
In-Reply-To: <56C3A30D.5010101-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
Hello Peter
On 02/16/2016 11:30 PM, Peter Hurley wrote:
> On 02/15/2016 07:28 AM, Michael Kerrisk (man-pages) wrote:
>> Hello Tobias,
>>
>> On 02/15/2016 02:26 PM, Dr. Tobias Quathamer wrote:
>>> See https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/drivers/tty/n_tty.c#n1673
>>> See https://bugs.debian.org/797479
>>> ---
>>> man3/termios.3 | 9 +++++++++
>>> 1 file changed, 9 insertions(+)
>>>
>>> diff --git a/man3/termios.3 b/man3/termios.3
>>> index 7d738d4..3f57607 100644
>>> --- a/man3/termios.3
>>> +++ b/man3/termios.3
>>> @@ -728,11 +728,20 @@ requested fewer bytes than are available in the current line of input,
>>> then only as many bytes as requested are read,
>>> and the remaining characters will be available for a future
>>> .BR read (2).
>>> +.IP * 2
>>> +The maximum line length is 4096 chars (including the line termination
>>> +char); lines longer than 4096 chars are truncated. After 4095 chars,
>>> +input data is still processed but not stored. Overflow processing
>>> +ensures the tty can always receive more input until at least one
>>> +line can be read.
>>> .PP
>>> In noncanonical mode input is available immediately (without
>>> the user having to type a line-delimiter character),
>>> no input processing is performed,
>>> and line editing is disabled.
>>> +The read buffer will only accept 4095 chars; this provides the
>>> +necessary space for a newline char if the input mode is switched
>>> +to canonical.
>>> The settings of MIN
>>> .RI ( c_cc[VMIN] )
>>> and TIME
>>
>> Thanks for crafting this. I've applied, and tweaked a little to clarify
>> some details:
>>
>> * The maximum line length is 4096 chars (including the terminating
>> newline character); lines longer than 4096 chars are truncated.
>> After 4095 characters, input data up (but not including) any ter‐
>> minating newline is discarded. This ensures that the terminal
>> can always receive more input until at least one line can be
>> read.
>
> Hmm. Neither description is accurate of the observable behavior from userspace.
> For example, it's entirely possible to retrieve > 4096 bytes in non-canonical
> mode, at least since 3.12
Note that the text I quoted applies just to canonical mode:
In canonical mode:
[...]
* The maximum line length is 4096 chars (including the terminat‐
ing newline character); lines longer than 4096 chars are trun‐
cated. After 4095 characters, input data up (but not includ‐
ing) any terminating newline is discarded. This ensures that
the terminal can always receive more input until at least one
line can be read.
So, does that seem okay?
> And input processing continues on the input, even past 4096 bytes.
> Line editing, ISIG, ECHOxx processing still occurs.
Yes, but only in noncanonical mode, right?
>
> It is true that it is not possible to retrieve > 4096 char line in canonical
> mode, and I don't see that ever changing via read() because userspace may
> assume it has received a terminated line in 4096-byte read buffer.
Yep. So we all seem to agree.
> However, the noncanonical mode input buffer size may change in the near
> future.
Can you say some more about that? And what changed in 3.13 with respect
to noncanonical mode, by the way?
Cheers,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-02-17 10:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-15 13:26 [PATCH] termios.3: Document line length in canonical mode Dr. Tobias Quathamer
[not found] ` <1455542819-29184-1-git-send-email-toddy-8fiUuRrzOP0dnm+yROfE0A@public.gmane.org>
2016-02-15 15:28 ` Michael Kerrisk (man-pages)
[not found] ` <56C1EEA6.5080500-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-16 22:30 ` Peter Hurley
[not found] ` <56C3A30D.5010101-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2016-02-17 10:09 ` Michael Kerrisk (man-pages) [this message]
[not found] ` <56C446E3.2070501-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-17 16:37 ` Peter Hurley
[not found] ` <56C4A1E4.3090201-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2016-02-18 11:25 ` Michael Kerrisk (man-pages)
[not found] ` <56C5AA39.4090007-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-02-18 15:31 ` Peter Hurley
[not found] ` <56C5E3DC.6040504-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org>
2016-02-18 19:29 ` Michael Kerrisk (man-pages)
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=56C446E3.2070501@gmail.com \
--to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=danielsh-1oDqGaOF3Lkdnm+yROfE0A@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=peter-WaGBZJeGNqdsbIuE7sb01tBPR1lH4CV8@public.gmane.org \
--cc=toddy-8fiUuRrzOP0dnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).