[newlib-cygwin] Cygwin: console: Fix tcsetattr which was broken sinse cygwin 3.5.5
Takashi Yano
tyan0@sourceware.org
Tue Apr 8 04:05:03 GMT 2025
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=4b5dcf27c7f0eb15e8092f9e7fdc901c370cdea8
commit 4b5dcf27c7f0eb15e8092f9e7fdc901c370cdea8
Author: Takashi Yano <takashi.yano@nifty.ne.jp>
Date: Tue Apr 8 12:38:31 2025 +0900
Cygwin: console: Fix tcsetattr which was broken sinse cygwin 3.5.5
After the commit 84d77e5918e1 ("Cygwin: console: Disable
cons_master_thread in win32-input-mode") tcsetattr() no longer takes
effect for the console. This occurs because set_input_mode() and
set_output_mode() are now called in bg_check() only when the current
mode is not tty::cygwin. Before this commit, these functions were
always invoked in bg_check(), regardless of whether the current mode
was already tty::cygwin. As a result, the console mode was updated
every time read() or write() was called.
With this patch, set_input_mode() and set_output_mode() are called
in tcsetattr() to make it take effect.
Fixes: 84d77e5918e1 ("Cygwin: console: Disable cons_master_thread in win32-input-mode")
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Diff:
---
winsup/cygwin/fhandler/console.cc | 2 ++
winsup/cygwin/release/3.6.1 | 2 ++
2 files changed, 4 insertions(+)
diff --git a/winsup/cygwin/fhandler/console.cc b/winsup/cygwin/fhandler/console.cc
index f162698a8..a38487f9b 100644
--- a/winsup/cygwin/fhandler/console.cc
+++ b/winsup/cygwin/fhandler/console.cc
@@ -2215,6 +2215,8 @@ int
fhandler_console::tcsetattr (int a, struct termios const *t)
{
get_ttyp ()->ti = *t;
+ set_input_mode (tty::cygwin, t, &handle_set);
+ set_output_mode (tty::cygwin, t, &handle_set);
return 0;
}
diff --git a/winsup/cygwin/release/3.6.1 b/winsup/cygwin/release/3.6.1
index 280952c91..e1bdd1727 100644
--- a/winsup/cygwin/release/3.6.1
+++ b/winsup/cygwin/release/3.6.1
@@ -39,3 +39,5 @@ Fixes:
- Don't increment DLL reference count in dladdr.
Addresses: https://cygwin.com/pipermail/cygwin/2025-April/257862.html
+
+- Fix tcsetattr() for console which has been broken sinse cygwin 3.5.5.
More information about the Cygwin-cvs
mailing list