| #
522083ff
|
| 16-Jan-2024 |
Kyle Evans <kevans@FreeBSD.org> |
kern: tty: recanonicalize the buffer on ICANON/VEOF/VEOL changes
Before this change, we would canonicalize any partial input if the new local mode is not ICANON, but that's about it. If we were swi
kern: tty: recanonicalize the buffer on ICANON/VEOF/VEOL changes
Before this change, we would canonicalize any partial input if the new local mode is not ICANON, but that's about it. If we were switching from -ICANON -> ICANON, or if VEOF/VEOL changes, then our internal canon accounting would be wrong.
The main consequence of this is that in ICANON mode, we would potentially hang a read(2) longer if the new VEOF/VEOL appears later in the buffer, and FIONREAD would be similarly wrong as a result.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D43456
show more ...
|
| #
d51dac5f
|
| 16-Jan-2024 |
Kyle Evans <kevans@FreeBSD.org> |
kern: tty: fix EOF handling for canonical reads
If the read(2) buffer is one byte short of an EOF, then we'll end up reading the line into the buffer, then re-entering and seeing an EOF at the begin
kern: tty: fix EOF handling for canonical reads
If the read(2) buffer is one byte short of an EOF, then we'll end up reading the line into the buffer, then re-entering and seeing an EOF at the beginning of the inq, assuming it's a zero-length line.
Fix this corner-case by searching one more byte than we have available for an EOF. If we found it, then we'll trim it here; otherwise, we'll limit our read to just the space we have in the out buffer and the next read(2) will (potentially) read the remainder of the line.
Fix FIONREAD while we're here to match what an application can expect read(2) to return -- scan for the first break character in the part of the input that's been canonicalized, we'll never return more than that.
PR: 276220 Reviewed by: cy, imp (both previous version), kib Differential Revision: https://reviews.freebsd.org/D43378
show more ...
|
| #
fdafd315
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remov
sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
Sponsored by: Netflix
show more ...
|
| #
c6d7be21
|
| 13-Nov-2023 |
Bojan Novković <bojan.novkovic@fer.hr> |
tty: properly check character position when handling IUTF8 backspaces
The tty_rubchar() code handling backspaces for UTF-8 characters didn't properly check whether the beginning of the current line
tty: properly check character position when handling IUTF8 backspaces
The tty_rubchar() code handling backspaces for UTF-8 characters didn't properly check whether the beginning of the current line was reached. This resulted in a kernel panic in ttyinq_unputchar() when prodded with certain malformed UTF-8 sequences.
Fixes: PR 275009 Reviewed by: christos MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42564
show more ...
|
| #
2fed1c57
|
| 13-Oct-2023 |
Bojan Novković <bojan.novkovic@fer.hr> |
tty/teken: fix UTF8 sequence validation logic
This patch fixes UTF-8 sequence validation logic in teken_utf8_bytes_to_codepoint() and fixes fallback behaviour in ttydisc_rubchar() when an invalid UT
tty/teken: fix UTF8 sequence validation logic
This patch fixes UTF-8 sequence validation logic in teken_utf8_bytes_to_codepoint() and fixes fallback behaviour in ttydisc_rubchar() when an invalid UTF8 sequence is encountered. The code previously used __bitcount() to extract sequence length information from the leading byte. However, this assumption breaks for certain code points that have additional bits set in the first half of the leading byte (e.g. Cyrillic characters). This lead to incorrect behaviour when deleting those characters using backspaces. The code now checks the number of consecutive set bits in the leading byte starting from the MSB, as per RFC 3629.
Reviewed by: christos MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D42147
show more ...
|
| #
9e589b09
|
| 07-Oct-2023 |
Bojan Novković <bojan.novkovic@fer.hr> |
tty: fix improper backspace behaviour for UTF8 characters when in canonical mode
This patch adds additional logic in ttydisc_rubchar() to properly handle backspace behaviour for UTF-8 characters.
C
tty: fix improper backspace behaviour for UTF8 characters when in canonical mode
This patch adds additional logic in ttydisc_rubchar() to properly handle backspace behaviour for UTF-8 characters.
Currently, typing in a backspace after a UTF8 character will delete only one byte from the byte sequence, leaving garbled output in the tty's output queue. With this change all of the character's bytes are deleted. This change is only active when the IUTF8 flag is set (see 19054eb6053189144aa962b2ecc1bf5087758a3e "(s)tty: add support for IUTF8 input flag")
The code uses the teken_wcwidth() function to properly handle character column widths for different code points, and adds the teken_utf8_bytes_to_codepoint() function that converts a UTF-8 byte sequence to a codepoint, as specified in RFC3629.
Reported by: christos Reviewed by: christos, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D42067
show more ...
|
| #
685dc743
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
4d846d26
|
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
| #
e2515283
|
| 27-Aug-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
| #
cbda6f66
|
| 27-Aug-2020 |
Warner Losh <imp@FreeBSD.org> |
Implement FLUSHO
Turn FLUSHO on/off with ^O (or whatever VDISCARD is). Honor that to throw away output quickly. This tries to remain true to 4.4BSD behavior (since that was the origin of this featur
Implement FLUSHO
Turn FLUSHO on/off with ^O (or whatever VDISCARD is). Honor that to throw away output quickly. This tries to remain true to 4.4BSD behavior (since that was the origin of this feature), with any corrections NetBSD has done. Since the implemenations are a little different, though, some edge conditions may be handled differently.
Reviewed by: kib, kevans Differential Review: https://reviews.freebsd.org/D26148
show more ...
|
| #
23d53268
|
| 17-Apr-2020 |
Kyle Evans <kevans@FreeBSD.org> |
tty: convert tty_lock_assert to tty_assert_locked to hide lock type
A later change, currently being iterated on in D24459, will in-fact change the lock type to an sx so that TTY drivers can sleep on
tty: convert tty_lock_assert to tty_assert_locked to hide lock type
A later change, currently being iterated on in D24459, will in-fact change the lock type to an sx so that TTY drivers can sleep on it if they need to. Committing this ahead of time to make the review in question a little more palatable.
tty_lock_assert() is unfortunately still needed for now in two places to make sure that the tty lock has not been recursed upon, for those scenarios where it's supplied by the TTY driver and possibly a mutex that is allowed to recurse.
Suggested by: markj
show more ...
|
| #
c6879c6c
|
| 23-Oct-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r339015 through r339669.
|
| #
6858c2cc
|
| 20-Oct-2018 |
Conrad Meyer <cem@FreeBSD.org> |
Replace ttyprintf with sbuf_printf and tty drain routine
Add string variants of cnputc and tty_putchar, and use them from the tty sbuf drain routine.
Suggested by: ed@ Sponsored by: Dell EMC Isilon
|
| #
522083ff
|
| 16-Jan-2024 |
Kyle Evans <kevans@FreeBSD.org> |
kern: tty: recanonicalize the buffer on ICANON/VEOF/VEOL changes
Before this change, we would canonicalize any partial input if the new local mode is not ICANON, but that's about it. If we were swi
kern: tty: recanonicalize the buffer on ICANON/VEOF/VEOL changes
Before this change, we would canonicalize any partial input if the new local mode is not ICANON, but that's about it. If we were switching from -ICANON -> ICANON, or if VEOF/VEOL changes, then our internal canon accounting would be wrong.
The main consequence of this is that in ICANON mode, we would potentially hang a read(2) longer if the new VEOF/VEOL appears later in the buffer, and FIONREAD would be similarly wrong as a result.
Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D43456
show more ...
|
| #
d51dac5f
|
| 16-Jan-2024 |
Kyle Evans <kevans@FreeBSD.org> |
kern: tty: fix EOF handling for canonical reads
If the read(2) buffer is one byte short of an EOF, then we'll end up reading the line into the buffer, then re-entering and seeing an EOF at the begin
kern: tty: fix EOF handling for canonical reads
If the read(2) buffer is one byte short of an EOF, then we'll end up reading the line into the buffer, then re-entering and seeing an EOF at the beginning of the inq, assuming it's a zero-length line.
Fix this corner-case by searching one more byte than we have available for an EOF. If we found it, then we'll trim it here; otherwise, we'll limit our read to just the space we have in the out buffer and the next read(2) will (potentially) read the remainder of the line.
Fix FIONREAD while we're here to match what an application can expect read(2) to return -- scan for the first break character in the part of the input that's been canonicalized, we'll never return more than that.
PR: 276220 Reviewed by: cy, imp (both previous version), kib Differential Revision: https://reviews.freebsd.org/D43378
show more ...
|
| #
fdafd315
|
| 24-Nov-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remov
sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row.
Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/
Sponsored by: Netflix
show more ...
|
| #
c6d7be21
|
| 13-Nov-2023 |
Bojan Novković <bojan.novkovic@fer.hr> |
tty: properly check character position when handling IUTF8 backspaces
The tty_rubchar() code handling backspaces for UTF-8 characters didn't properly check whether the beginning of the current line
tty: properly check character position when handling IUTF8 backspaces
The tty_rubchar() code handling backspaces for UTF-8 characters didn't properly check whether the beginning of the current line was reached. This resulted in a kernel panic in ttyinq_unputchar() when prodded with certain malformed UTF-8 sequences.
Fixes: PR 275009 Reviewed by: christos MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D42564
show more ...
|
| #
2fed1c57
|
| 13-Oct-2023 |
Bojan Novković <bojan.novkovic@fer.hr> |
tty/teken: fix UTF8 sequence validation logic
This patch fixes UTF-8 sequence validation logic in teken_utf8_bytes_to_codepoint() and fixes fallback behaviour in ttydisc_rubchar() when an invalid UT
tty/teken: fix UTF8 sequence validation logic
This patch fixes UTF-8 sequence validation logic in teken_utf8_bytes_to_codepoint() and fixes fallback behaviour in ttydisc_rubchar() when an invalid UTF8 sequence is encountered. The code previously used __bitcount() to extract sequence length information from the leading byte. However, this assumption breaks for certain code points that have additional bits set in the first half of the leading byte (e.g. Cyrillic characters). This lead to incorrect behaviour when deleting those characters using backspaces. The code now checks the number of consecutive set bits in the leading byte starting from the MSB, as per RFC 3629.
Reviewed by: christos MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D42147
show more ...
|
| #
9e589b09
|
| 07-Oct-2023 |
Bojan Novković <bojan.novkovic@fer.hr> |
tty: fix improper backspace behaviour for UTF8 characters when in canonical mode
This patch adds additional logic in ttydisc_rubchar() to properly handle backspace behaviour for UTF-8 characters.
C
tty: fix improper backspace behaviour for UTF8 characters when in canonical mode
This patch adds additional logic in ttydisc_rubchar() to properly handle backspace behaviour for UTF-8 characters.
Currently, typing in a backspace after a UTF8 character will delete only one byte from the byte sequence, leaving garbled output in the tty's output queue. With this change all of the character's bytes are deleted. This change is only active when the IUTF8 flag is set (see 19054eb6053189144aa962b2ecc1bf5087758a3e "(s)tty: add support for IUTF8 input flag")
The code uses the teken_wcwidth() function to properly handle character column widths for different code points, and adds the teken_utf8_bytes_to_codepoint() function that converts a UTF-8 byte sequence to a codepoint, as specified in RFC3629.
Reported by: christos Reviewed by: christos, imp MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D42067
show more ...
|
| #
685dc743
|
| 16-Aug-2023 |
Warner Losh <imp@FreeBSD.org> |
sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
|
| #
4d846d26
|
| 10-May-2023 |
Warner Losh <imp@FreeBSD.org> |
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of
spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause.
Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
show more ...
|
| #
e2515283
|
| 27-Aug-2020 |
Glen Barber <gjb@FreeBSD.org> |
MFH
Sponsored by: Rubicon Communications, LLC (netgate.com)
|
| #
cbda6f66
|
| 27-Aug-2020 |
Warner Losh <imp@FreeBSD.org> |
Implement FLUSHO
Turn FLUSHO on/off with ^O (or whatever VDISCARD is). Honor that to throw away output quickly. This tries to remain true to 4.4BSD behavior (since that was the origin of this featur
Implement FLUSHO
Turn FLUSHO on/off with ^O (or whatever VDISCARD is). Honor that to throw away output quickly. This tries to remain true to 4.4BSD behavior (since that was the origin of this feature), with any corrections NetBSD has done. Since the implemenations are a little different, though, some edge conditions may be handled differently.
Reviewed by: kib, kevans Differential Review: https://reviews.freebsd.org/D26148
show more ...
|
| #
23d53268
|
| 17-Apr-2020 |
Kyle Evans <kevans@FreeBSD.org> |
tty: convert tty_lock_assert to tty_assert_locked to hide lock type
A later change, currently being iterated on in D24459, will in-fact change the lock type to an sx so that TTY drivers can sleep on
tty: convert tty_lock_assert to tty_assert_locked to hide lock type
A later change, currently being iterated on in D24459, will in-fact change the lock type to an sx so that TTY drivers can sleep on it if they need to. Committing this ahead of time to make the review in question a little more palatable.
tty_lock_assert() is unfortunately still needed for now in two places to make sure that the tty lock has not been recursed upon, for those scenarios where it's supplied by the TTY driver and possibly a mutex that is allowed to recurse.
Suggested by: markj
show more ...
|
| #
c6879c6c
|
| 23-Oct-2018 |
Dimitry Andric <dim@FreeBSD.org> |
Merge ^/head r339015 through r339669.
|