public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Takashi Yano <tyan0@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin] Cygwin: pty: Fix reading CONIN$ when stdin is not a pty. Date: Fri, 14 Apr 2023 03:37:43 +0000 (GMT) [thread overview] Message-ID: <20230414033743.032673858D33@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=e5fcc5837c9594ccb7d0d6f40af69f266f606c5b commit e5fcc5837c9594ccb7d0d6f40af69f266f606c5b Author: Takashi Yano <takashi.yano@nifty.ne.jp> Date: Fri Apr 14 10:52:08 2023 +0900 Cygwin: pty: Fix reading CONIN$ when stdin is not a pty. Previously, the pty master sends inputs to the pipe for cygwin app even when pseudo console is activated if stdin is not the pty. This causes the problem that key input is not sent to non cygwin app even if the app opens CONIN$. This patch sets switch_to_nat_pipe to true regardless whether stdin is the pty or not to allow that case. https://cygwin.com/pipermail/cygwin/2023-April/253424.html Reported-by: Wladislav Artsimovich <cygwin@frost.kiwi> Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp> Diff: --- winsup/cygwin/fhandler/pty.cc | 6 ++++++ winsup/cygwin/release/3.4.7 | 3 +++ 2 files changed, 9 insertions(+) diff --git a/winsup/cygwin/fhandler/pty.cc b/winsup/cygwin/fhandler/pty.cc index 664d7dbc6..03c859172 100644 --- a/winsup/cygwin/fhandler/pty.cc +++ b/winsup/cygwin/fhandler/pty.cc @@ -3222,6 +3222,11 @@ fhandler_pty_slave::setup_pseudoconsole () return false; } + /* Set switch_to_nat_pipe regardless whether stdin is the pty or not + so that the non-cygwin app can work when it opens CONIN$. */ + bool switch_to_nat_pipe_orig = get_ttyp ()->switch_to_nat_pipe; + get_ttyp ()->switch_to_nat_pipe = true; + HANDLE hpConIn, hpConOut; if (get_ttyp ()->pcon_activated) { /* The pseudo console is already activated. */ @@ -3499,6 +3504,7 @@ cleanup_pseudo_console: CloseHandle (tmp); } fallback: + get_ttyp ()->switch_to_nat_pipe = switch_to_nat_pipe_orig; return false; } diff --git a/winsup/cygwin/release/3.4.7 b/winsup/cygwin/release/3.4.7 index 2c305ec5f..941519ebc 100644 --- a/winsup/cygwin/release/3.4.7 +++ b/winsup/cygwin/release/3.4.7 @@ -9,3 +9,6 @@ Bug Fixes - Align behaviour of dirname in terms of leading slashes to POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html + +- Fix reading CONIN$ in non cygwin apps when stdin is not a pty. + Addresses https://cygwin.com/pipermail/cygwin/2023-April/253424.html
reply other threads:[~2023-04-14 3:37 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230414033743.032673858D33@sourceware.org \ --to=tyan0@sourceware.org \ --cc=cygwin-cvs@sourceware.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: linkBe 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 read-only IMAP folder(s) and NNTP newsgroup(s).