Merge pull request #2862 from dscho/msys2-runtime-console-backports
msys2-runtime: backport recent console patches
This commit is contained in:
commit
53946fe84b
@ -2709,5 +2709,5 @@ index eb2a870..3bf9d9f 100755
|
||||
lt_cv_dlopen_libs=
|
||||
;;
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -25,5 +25,5 @@ index b900960..617a9c2 100755
|
||||
my ($file, $member, $symbol) = m%^([^:]*):([^:]*(?=:))?.* T (.*)%o;
|
||||
next if !defined($symbol) || $symbol =~ $exclude_regex;
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -1442,5 +1442,5 @@ index 4c98eef..ad35d23 100644
|
||||
"The \"-b\" means 'skip the help pages'. You can omit this until you're\n"
|
||||
"familiar with the report layout. The gprof documentation explains\n"
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -1096,5 +1096,5 @@ index e3a65f8..1aeec8d 100644
|
||||
{
|
||||
for (int i = calloced; i < argc; i++)
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -191,5 +191,5 @@ index 3502166..daed73f 100644
|
||||
/* Add a hint to the sysname, that we're running under WOW64. This might
|
||||
give an early clue if somebody encounters problems. */
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -397,5 +397,5 @@ index 6aae33c..5736ffb 100644
|
||||
free (gecos);
|
||||
if (home)
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -233,5 +233,5 @@ index fe3df12..c9876c5 100644
|
||||
buf = tp.t_get ();
|
||||
cp = stpcpy (buf, SYMLINK_COOKIE);
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -35,5 +35,5 @@ index 296c890..2e290a8 100644
|
||||
else if (*newp == 'M' && strncmp (newp, "MSYS=", 5) == 0)
|
||||
parse_options (newp + 5);
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -29,5 +29,5 @@ index 1af1f3d..cc2e030 100644
|
||||
{
|
||||
set_errno (E2BIG);
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -54,5 +54,5 @@ index c9876c5..7f7ded4 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -76,5 +76,5 @@ index 0d99d84..1562e27 100644
|
||||
|
||||
/* Convert argv[0] to posix rules if it's currently blatantly
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -56,5 +56,5 @@ index 1562e27..3d7974e 100644
|
||||
size_t cnt = isascii (*s) ? 1 : mbtowc (NULL, s, MB_CUR_MAX);
|
||||
if (cnt <= 1 || cnt == (size_t)-1)
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -68,5 +68,5 @@ index de4abc4..3dbce3b 100644
|
||||
NULL, /* Security */
|
||||
NULL, /* thread */
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -21,5 +21,5 @@ index 3d7974e..3434316 100644
|
||||
while (*cmd)
|
||||
{
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -20,5 +20,5 @@ index 3dbce3b..4e5d24c 100644
|
||||
SetConsoleCtrlHandler (NULL, 0);
|
||||
/* Commit message for this code was:
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -172,5 +172,5 @@ index cc2e030..abe7b60 100644
|
||||
|
||||
/* Check if we have been called from exec{lv}p or spawn{lv}p and mask
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -21,5 +21,5 @@ index abe7b60..698cf8f 100644
|
||||
|
||||
if (buf.isdir ())
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -22,5 +22,5 @@ index e254397..2a03ac1 100644
|
||||
LoadDLLfunc (VirtualAlloc2, 28, KernelBase)
|
||||
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -36,5 +36,5 @@ index 4e5d24c..a4713a2 100644
|
||||
SetConsoleCtrlHandler (NULL, 0);
|
||||
/* Commit message for this code was:
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -50,5 +50,5 @@ index 72e8f8f..eda7af5 100644
|
||||
bool NO_COPY in_forkee;
|
||||
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -53,5 +53,5 @@ index 49631d6..daaa1ec 100644
|
||||
*k->setting.x &= ~k->values[istrue].i;
|
||||
if (istrue || (eq && strtol (eq, NULL, 0)))
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -30,5 +30,5 @@ index 99ddbce..55fea8c 100644
|
||||
|
||||
/* Reinstate the close-on-exec state */
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -51,5 +51,5 @@ index 0000000..4e1d498
|
||||
+ name: install
|
||||
+ path: _dest/
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -42,5 +42,5 @@ index 0000000..57bd30e
|
||||
+ run: |
|
||||
+ git push https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY refs/heads/cygwin/master 'refs/tags/*:refs/tags/*'
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -52,5 +52,5 @@ index 649084d..28056e6 100644
|
||||
|
||||
<listitem>
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -31,5 +31,5 @@ index f9a9a7a..4b541a8 100644
|
||||
jobs:
|
||||
fedora-build:
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -64,5 +64,5 @@ index 698cf8f..d7ee5fe 100644
|
||||
|
||||
/* We're adding the CREATE_BREAKAWAY_FROM_JOB flag here to workaround
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -381,5 +381,5 @@ index 0000000..25814c7
|
||||
+ return 0;
|
||||
+}
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -501,5 +501,5 @@ index 0000000..0486a0c
|
||||
+
|
||||
+#endif
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -50,5 +50,5 @@ index d0fb547..ad718c3 100644
|
||||
}
|
||||
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -51,5 +51,5 @@ index 88fd815..ca65127 100644
|
||||
PWCHAR fpbuf = tp.w_get ();
|
||||
DWORD ret;
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -45,5 +45,5 @@ index 534d674..d448ede 100644
|
||||
uninstall-extra-man:
|
||||
for i in *.1 ; do \
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -27,5 +27,5 @@ index 8002714..d1d6116 100644
|
||||
$(INSTALL_PROGRAM) $(TEST_DLL_NAME) $(DESTDIR)$(bindir)/$(DLL_NAME)
|
||||
@$(MKDIR_P) $(DESTDIR)$(toollibdir)
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -107,5 +107,5 @@ index 71c3f22..f33740d 100644
|
||||
const char * get_native () const {return native ? native + namelen : NULL;}
|
||||
const char * get_posix () const {return posix ? posix : NULL;}
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -47,5 +47,5 @@ index 5c197a6..5afac8d 100644
|
||||
/* P Q R S T U V W */
|
||||
WC, 0, 0, WC, WC, 0, 0, 0,
|
||||
--
|
||||
2.34.1
|
||||
2.35.1
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
From c8568e060566b623e5c20be7692882bdc16a4862 Mon Sep 17 00:00:00 2001
|
||||
From: Mitchell Hentges <mhentges@mozilla.com>
|
||||
Date: Thu, 10 Feb 2022 10:38:08 -0500
|
||||
Subject: [PATCH 36/N] Cygwin: console: Maintain
|
||||
ENABLE_(INSERT|QUICK_EDIT)_MODE flags.
|
||||
|
||||
- Currently, ENABLE_INSERT_MODE and ENABLE_QUICK_EDIT_MODE are cleared
|
||||
if cygwin is started in console. These flags will not be recovered
|
||||
even when exiting from cygwin. Also note that if ENABLE_EXTENDED_FLAGS
|
||||
is once unset, then the flag ENABLE_QUICK_EDIT_MODE it's associated
|
||||
with will no longer be preserved. Unfortunately, we're accidentally
|
||||
stepping on this in fhandler_console::set_input_mode().
|
||||
|
||||
This patch solves this by carrying forward these flags in the place
|
||||
where it had been ignoring them. Since the previous behaviour of
|
||||
leaving these flags unset would essentially maintain their existing
|
||||
state, adding the carry-over of the flags now should not alter console
|
||||
behaviour.
|
||||
---
|
||||
winsup/cygwin/fhandler_console.cc | 8 +++++---
|
||||
1 file changed, 5 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
|
||||
index da1d2e8..7d59dd2 100644
|
||||
--- a/winsup/cygwin/fhandler_console.cc
|
||||
+++ b/winsup/cygwin/fhandler_console.cc
|
||||
@@ -458,16 +458,18 @@ void
|
||||
fhandler_console::set_input_mode (tty::cons_mode m, const termios *t,
|
||||
const handle_set_t *p)
|
||||
{
|
||||
- DWORD flags = 0, oflags;
|
||||
+ DWORD oflags;
|
||||
WaitForSingleObject (p->input_mutex, mutex_timeout);
|
||||
GetConsoleMode (p->input_handle, &oflags);
|
||||
+ DWORD flags = oflags
|
||||
+ & (ENABLE_EXTENDED_FLAGS | ENABLE_INSERT_MODE | ENABLE_QUICK_EDIT_MODE);
|
||||
switch (m)
|
||||
{
|
||||
case tty::restore:
|
||||
- flags = ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
|
||||
+ flags |= ENABLE_ECHO_INPUT | ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT;
|
||||
break;
|
||||
case tty::cygwin:
|
||||
- flags = ENABLE_WINDOW_INPUT;
|
||||
+ flags |= ENABLE_WINDOW_INPUT;
|
||||
if (wincap.has_con_24bit_colors () && !con_is_legacy)
|
||||
flags |= ENABLE_VIRTUAL_TERMINAL_INPUT;
|
||||
else
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,120 @@
|
||||
From 4f54570fab07be5947b973af652b6183f3b29fcd Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Thu, 10 Feb 2022 16:53:47 +0900
|
||||
Subject: [PATCH 37/N] Cygwin: pty, console: Fix Ctrl-C handling for
|
||||
non-cygwin apps.
|
||||
|
||||
- Currently, if cat is started from cmd.exe which is started in cygwin
|
||||
console, Ctrl-C terminates not only cat but also cmd.exe. This also
|
||||
happens in pty in which pseudo console is disabled. This patch fixes
|
||||
the issue.
|
||||
---
|
||||
winsup/cygwin/fhandler_console.cc | 28 +++++++++++++++++++++++
|
||||
winsup/cygwin/fhandler_termios.cc | 38 +++++++++++++++++++++++++++++++
|
||||
2 files changed, 66 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
|
||||
index 7d59dd2..996561b 100644
|
||||
--- a/winsup/cygwin/fhandler_console.cc
|
||||
+++ b/winsup/cygwin/fhandler_console.cc
|
||||
@@ -238,6 +238,33 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp)
|
||||
char c = (char) wc;
|
||||
bool processed = false;
|
||||
termios &ti = ttyp->ti;
|
||||
+ pinfo pi (ttyp->getpgid ());
|
||||
+ if (pi && pi->ctty == ttyp->ntty
|
||||
+ && (pi->process_state & PID_NOTCYGWIN)
|
||||
+ && input_rec[i].EventType == KEY_EVENT && c == '\003')
|
||||
+ {
|
||||
+ bool not_a_sig = false;
|
||||
+ if (!CCEQ (ti.c_cc[VINTR], c)
|
||||
+ && !CCEQ (ti.c_cc[VQUIT], c)
|
||||
+ && !CCEQ (ti.c_cc[VSUSP], c))
|
||||
+ not_a_sig = true;
|
||||
+ if (input_rec[i].Event.KeyEvent.bKeyDown)
|
||||
+ {
|
||||
+ /* CTRL_C_EVENT does not work for the process started with
|
||||
+ CREATE_NEW_PROCESS_GROUP flag, so send CTRL_BREAK_EVENT
|
||||
+ instead. */
|
||||
+ if (pi->process_state & PID_NEW_PG)
|
||||
+ GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT,
|
||||
+ pi->dwProcessId);
|
||||
+ else
|
||||
+ GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0);
|
||||
+ if (not_a_sig)
|
||||
+ goto skip_writeback;
|
||||
+ }
|
||||
+ processed = true;
|
||||
+ if (not_a_sig)
|
||||
+ goto remove_record;
|
||||
+ }
|
||||
switch (input_rec[i].EventType)
|
||||
{
|
||||
case KEY_EVENT:
|
||||
@@ -310,6 +337,7 @@ fhandler_console::cons_master_thread (handle_set_t *p, tty *ttyp)
|
||||
processed = true;
|
||||
break;
|
||||
}
|
||||
+remove_record:
|
||||
if (processed)
|
||||
{ /* Remove corresponding record. */
|
||||
memmove (input_rec + i, input_rec + i + 1,
|
||||
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
|
||||
index 3461d17..fe10215 100644
|
||||
--- a/winsup/cygwin/fhandler_termios.cc
|
||||
+++ b/winsup/cygwin/fhandler_termios.cc
|
||||
@@ -147,6 +147,8 @@ tty_min::kill_pgrp (int sig)
|
||||
_pinfo *p = pids[i];
|
||||
if (!p || !p->exists () || p->ctty != ntty || p->pgid != pgid)
|
||||
continue;
|
||||
+ if (p->process_state & PID_NOTCYGWIN)
|
||||
+ continue;
|
||||
if (p == myself)
|
||||
killself = sig != __SIGSETPGRP && !exit_state;
|
||||
else
|
||||
@@ -326,6 +328,42 @@ fhandler_termios::line_edit (const char *rptr, size_t nread, termios& ti,
|
||||
|
||||
if (ti.c_iflag & ISTRIP)
|
||||
c &= 0x7f;
|
||||
+ winpids pids ((DWORD) 0);
|
||||
+ if (get_ttyp ()->pcon_input_state_eq (tty::to_nat))
|
||||
+ {
|
||||
+ bool need_discard_input = false;
|
||||
+ for (unsigned i = 0; i < pids.npids; i++)
|
||||
+ {
|
||||
+ _pinfo *p = pids[i];
|
||||
+ if (c == '\003' && p && p->ctty == tc ()->ntty
|
||||
+ && p->pgid == tc ()->getpgid ()
|
||||
+ && (p->process_state & PID_NOTCYGWIN))
|
||||
+ {
|
||||
+ /* CTRL_C_EVENT does not work for the process started with
|
||||
+ CREATE_NEW_PROCESS_GROUP flag, so send CTRL_BREAK_EVENT
|
||||
+ instead. */
|
||||
+ if (p->process_state & PID_NEW_PG)
|
||||
+ GenerateConsoleCtrlEvent (CTRL_BREAK_EVENT,
|
||||
+ p->dwProcessId);
|
||||
+ else
|
||||
+ GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0);
|
||||
+ need_discard_input = true;
|
||||
+ }
|
||||
+ }
|
||||
+ if (need_discard_input
|
||||
+ && !CCEQ (ti.c_cc[VINTR], c)
|
||||
+ && !CCEQ (ti.c_cc[VQUIT], c)
|
||||
+ && !CCEQ (ti.c_cc[VSUSP], c))
|
||||
+ {
|
||||
+ if (!(ti.c_lflag & NOFLSH))
|
||||
+ {
|
||||
+ eat_readahead (-1);
|
||||
+ discard_input ();
|
||||
+ }
|
||||
+ ti.c_lflag &= ~FLUSHO;
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
if (ti.c_lflag & ISIG)
|
||||
{
|
||||
int sig;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,67 @@
|
||||
From 69e9facbd4909e77bc1f991076867740eb07ad3a Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Sat, 12 Feb 2022 17:51:55 +0900
|
||||
Subject: [PATCH 38/N] Cygwin: pty: Pass Ctrl-Z (EOF) to non-cygwin apps with
|
||||
disable_pcon.
|
||||
|
||||
- Previously, non-cygwin app running in pty started without pseudo
|
||||
console support was suspended by Ctrl-Z rather than sending EOF.
|
||||
Even worse, suspended app could not be resumed by fg command. With
|
||||
this patch, Ctrl-Z (EOF for non-cygwin apps) is passed to non-cygwin
|
||||
app instead of suspending that app. This patch also handles Ctrl-\
|
||||
(QUIT) and Ctrl-D (EOF) as well.
|
||||
---
|
||||
winsup/cygwin/fhandler_termios.cc | 13 +++++++++----
|
||||
1 file changed, 9 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
|
||||
index fe10215..b935a70 100644
|
||||
--- a/winsup/cygwin/fhandler_termios.cc
|
||||
+++ b/winsup/cygwin/fhandler_termios.cc
|
||||
@@ -329,6 +329,7 @@ fhandler_termios::line_edit (const char *rptr, size_t nread, termios& ti,
|
||||
if (ti.c_iflag & ISTRIP)
|
||||
c &= 0x7f;
|
||||
winpids pids ((DWORD) 0);
|
||||
+ bool need_check_sigs = get_ttyp ()->pcon_input_state_eq (tty::to_cyg);
|
||||
if (get_ttyp ()->pcon_input_state_eq (tty::to_nat))
|
||||
{
|
||||
bool need_discard_input = false;
|
||||
@@ -349,11 +350,15 @@ fhandler_termios::line_edit (const char *rptr, size_t nread, termios& ti,
|
||||
GenerateConsoleCtrlEvent (CTRL_C_EVENT, 0);
|
||||
need_discard_input = true;
|
||||
}
|
||||
+ if (p->ctty == get_ttyp ()->ntty
|
||||
+ && p->pgid == get_ttyp ()->getpgid () && !p->cygstarted)
|
||||
+ need_check_sigs = true;
|
||||
}
|
||||
- if (need_discard_input
|
||||
- && !CCEQ (ti.c_cc[VINTR], c)
|
||||
+ if (!CCEQ (ti.c_cc[VINTR], c)
|
||||
&& !CCEQ (ti.c_cc[VQUIT], c)
|
||||
&& !CCEQ (ti.c_cc[VSUSP], c))
|
||||
+ need_check_sigs = false;
|
||||
+ if (need_discard_input && !need_check_sigs)
|
||||
{
|
||||
if (!(ti.c_lflag & NOFLSH))
|
||||
{
|
||||
@@ -364,7 +369,7 @@ fhandler_termios::line_edit (const char *rptr, size_t nread, termios& ti,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
- if (ti.c_lflag & ISIG)
|
||||
+ if ((ti.c_lflag & ISIG) && need_check_sigs)
|
||||
{
|
||||
int sig;
|
||||
if (CCEQ (ti.c_cc[VINTR], c))
|
||||
@@ -469,7 +474,7 @@ fhandler_termios::line_edit (const char *rptr, size_t nread, termios& ti,
|
||||
}
|
||||
continue;
|
||||
}
|
||||
- else if (CCEQ (ti.c_cc[VEOF], c))
|
||||
+ else if (CCEQ (ti.c_cc[VEOF], c) && need_check_sigs)
|
||||
{
|
||||
termios_printf ("EOF");
|
||||
accept_input ();
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
From 9d5dfc73fd91cffbd4b4de0cb969e6e474072de4 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Thu, 10 Feb 2022 17:22:11 +0900
|
||||
Subject: [PATCH 39/N] Cygwin: pty: Prevent deadlock on echo output.
|
||||
|
||||
- If the slave process writes a lot of text output, doecho() can
|
||||
cause deadlock. This is because output_mutex is held in slave::
|
||||
write() and if WriteFile() is blocked due to pipe full, doecho()
|
||||
tries to acquire output_mutex and gets into deadlock. With this
|
||||
patch, the deadlock is prevented on the sacrifice of atomicity
|
||||
of doecho().
|
||||
---
|
||||
winsup/cygwin/fhandler_tty.cc | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
|
||||
index 10566ac..c1c2c1d 100644
|
||||
--- a/winsup/cygwin/fhandler_tty.cc
|
||||
+++ b/winsup/cygwin/fhandler_tty.cc
|
||||
@@ -496,11 +496,9 @@ void
|
||||
fhandler_pty_master::doecho (const void *str, DWORD len)
|
||||
{
|
||||
ssize_t towrite = len;
|
||||
- acquire_output_mutex (mutex_timeout);
|
||||
if (!process_opost_output (echo_w, str, towrite, true,
|
||||
get_ttyp (), is_nonblocking ()))
|
||||
termios_printf ("Write to echo pipe failed, %E");
|
||||
- release_output_mutex ();
|
||||
}
|
||||
|
||||
int
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,99 @@
|
||||
From 223769c731c7d83b254c911b4fa5c671ebe79e64 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Thu, 10 Feb 2022 17:47:51 +0900
|
||||
Subject: [PATCH 40/N] Cygwin: pty: Revise the code to wait for completion of
|
||||
forwarding.
|
||||
|
||||
- With this patch, the code to wait for completion of forwarding of
|
||||
output from non-cygwin app is revised so that it can more reliably
|
||||
detect the completion.
|
||||
---
|
||||
winsup/cygwin/fhandler_tty.cc | 5 ++++-
|
||||
winsup/cygwin/tty.cc | 11 ++++++-----
|
||||
winsup/cygwin/tty.h | 3 ++-
|
||||
3 files changed, 12 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
|
||||
index c1c2c1d..6217883 100644
|
||||
--- a/winsup/cygwin/fhandler_tty.cc
|
||||
+++ b/winsup/cygwin/fhandler_tty.cc
|
||||
@@ -1122,7 +1122,7 @@ fhandler_pty_slave::reset_switch_to_pcon (void)
|
||||
if (WaitForSingleObject (h_gdb_process, 0) == WAIT_TIMEOUT)
|
||||
{
|
||||
if (isHybrid)
|
||||
- get_ttyp ()->wait_pcon_fwd (false);
|
||||
+ get_ttyp ()->wait_pcon_fwd ();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2717,6 +2717,9 @@ fhandler_pty_master::pty_master_fwd_thread (const master_fwd_thread_param_t *p)
|
||||
for (;;)
|
||||
{
|
||||
p->ttyp->pcon_last_time = GetTickCount ();
|
||||
+ DWORD n;
|
||||
+ p->ttyp->pcon_fwd_not_empty =
|
||||
+ ::bytes_available (n, p->from_slave_nat) && n;
|
||||
if (!ReadFile (p->from_slave_nat, outbuf, NT_MAX_PATH, &rlen, NULL))
|
||||
{
|
||||
termios_printf ("ReadFile for forwarding failed, %E");
|
||||
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
|
||||
index 7895288..da75b8d 100644
|
||||
--- a/winsup/cygwin/tty.cc
|
||||
+++ b/winsup/cygwin/tty.cc
|
||||
@@ -240,6 +240,7 @@ tty::init ()
|
||||
pcon_pid = 0;
|
||||
term_code_page = 0;
|
||||
pcon_last_time = 0;
|
||||
+ pcon_fwd_not_empty = false;
|
||||
pcon_start = false;
|
||||
pcon_start_pid = 0;
|
||||
pcon_cap_checked = false;
|
||||
@@ -367,7 +368,7 @@ tty_min::setpgid (int pid)
|
||||
}
|
||||
|
||||
void
|
||||
-tty::wait_pcon_fwd (bool init)
|
||||
+tty::wait_pcon_fwd ()
|
||||
{
|
||||
/* The forwarding in pseudo console sometimes stops for
|
||||
16-32 msec even if it already has data to transfer.
|
||||
@@ -377,11 +378,11 @@ tty::wait_pcon_fwd (bool init)
|
||||
thread when the last data is transfered. */
|
||||
const int sleep_in_pcon = 16;
|
||||
const int time_to_wait = sleep_in_pcon * 2 + 1/* margine */;
|
||||
- if (init)
|
||||
- pcon_last_time = GetTickCount ();
|
||||
- while (GetTickCount () - pcon_last_time < time_to_wait)
|
||||
+ int elapsed;
|
||||
+ while (pcon_fwd_not_empty
|
||||
+ || (elapsed = GetTickCount () - pcon_last_time) < time_to_wait)
|
||||
{
|
||||
- int tw = time_to_wait - (GetTickCount () - pcon_last_time);
|
||||
+ int tw = pcon_fwd_not_empty ? 10 : (time_to_wait - elapsed);
|
||||
cygwait (tw);
|
||||
}
|
||||
}
|
||||
diff --git a/winsup/cygwin/tty.h b/winsup/cygwin/tty.h
|
||||
index 519d7c0..2cd12a6 100644
|
||||
--- a/winsup/cygwin/tty.h
|
||||
+++ b/winsup/cygwin/tty.h
|
||||
@@ -116,6 +116,7 @@ private:
|
||||
DWORD pcon_pid;
|
||||
UINT term_code_page;
|
||||
DWORD pcon_last_time;
|
||||
+ bool pcon_fwd_not_empty;
|
||||
HANDLE h_pcon_write_pipe;
|
||||
HANDLE h_pcon_condrv_reference;
|
||||
HANDLE h_pcon_conhost_process;
|
||||
@@ -166,7 +167,7 @@ public:
|
||||
void set_master_ctl_closed () {master_pid = -1;}
|
||||
static void __stdcall create_master (int);
|
||||
static void __stdcall init_session ();
|
||||
- void wait_pcon_fwd (bool init = true);
|
||||
+ void wait_pcon_fwd ();
|
||||
bool pcon_input_state_eq (xfer_dir x) { return pcon_input_state == x; }
|
||||
bool pcon_fg (pid_t pgid);
|
||||
friend class fhandler_pty_common;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
From fa46a437767f1ac66742a41f56b4e4b1f052ccef Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Sun, 13 Feb 2022 02:16:32 +0900
|
||||
Subject: [PATCH 41/N] Cygwin: pty: Discard input in from_master_nat pipe on
|
||||
signal as well.
|
||||
|
||||
- Currently, pty discards input only in from_master pipe on signal.
|
||||
Due to this, if pty is started without pseudo console support and
|
||||
start a non-cygwin process from cmd.exe, type adhead input is not
|
||||
discarded on signals such as Ctrl-C. This patch fixes the issue.
|
||||
---
|
||||
winsup/cygwin/fhandler_tty.cc | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
|
||||
index 6217883..d80b530 100644
|
||||
--- a/winsup/cygwin/fhandler_tty.cc
|
||||
+++ b/winsup/cygwin/fhandler_tty.cc
|
||||
@@ -438,6 +438,9 @@ fhandler_pty_master::discard_input ()
|
||||
while (::bytes_available (bytes_in_pipe, from_master) && bytes_in_pipe)
|
||||
ReadFile (from_master, buf, sizeof(buf), &n, NULL);
|
||||
ResetEvent (input_available_event);
|
||||
+ if (!get_ttyp ()->pcon_activated)
|
||||
+ while (::bytes_available (bytes_in_pipe, from_master_nat) && bytes_in_pipe)
|
||||
+ ReadFile (from_master_nat, buf, sizeof(buf), &n, NULL);
|
||||
get_ttyp ()->discard_input = true;
|
||||
ReleaseMutex (input_mutex);
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
From 9b90fed7c54215a1b958806f11825650e6196aa6 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Sun, 13 Feb 2022 05:12:18 +0900
|
||||
Subject: [PATCH 42/N] Cygwin: pty: Fix a bug in tty_min::segpgid().
|
||||
|
||||
- In tty_min::setpgid(), a pointer to fhandler instance is casted to
|
||||
fhandler_pty_slave and accessed even if terminal is not a pty slave.
|
||||
This patch fixes the issue.
|
||||
---
|
||||
winsup/cygwin/tty.cc | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/winsup/cygwin/tty.cc b/winsup/cygwin/tty.cc
|
||||
index da75b8d..c0015ac 100644
|
||||
--- a/winsup/cygwin/tty.cc
|
||||
+++ b/winsup/cygwin/tty.cc
|
||||
@@ -309,7 +309,8 @@ tty_min::setpgid (int pid)
|
||||
fhandler_pty_slave *ptys = NULL;
|
||||
cygheap_fdenum cfd (false);
|
||||
while (cfd.next () >= 0 && ptys == NULL)
|
||||
- if (cfd->get_device () == getntty ())
|
||||
+ if (cfd->get_device () == getntty ()
|
||||
+ && cfd->get_major () == DEV_PTYS_MAJOR)
|
||||
ptys = (fhandler_pty_slave *) (fhandler_base *) cfd;
|
||||
|
||||
if (ptys)
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,286 @@
|
||||
From f5649ceeaccfd53b55127819a142cf20f15a2a3e Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Sun, 13 Feb 2022 12:03:45 +0900
|
||||
Subject: [PATCH 43/N] Cygwin: console: Fix console mode for non-cygwin
|
||||
inferior of GDB.
|
||||
|
||||
- Currently, there is no chance to change console mode for non-cygwin
|
||||
inferior of GDB. With this patch, the console mode is changed to
|
||||
tty::native in CreateProcess() and ContinueDebugEvent() hooked in
|
||||
fhandler_console.
|
||||
---
|
||||
winsup/cygwin/fhandler.h | 2 +
|
||||
winsup/cygwin/fhandler_console.cc | 39 +++++++++
|
||||
winsup/cygwin/fhandler_tty.cc | 128 +++++++++++++++---------------
|
||||
3 files changed, 107 insertions(+), 62 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h
|
||||
index 4226bfd..c2d91ea 100644
|
||||
--- a/winsup/cygwin/fhandler.h
|
||||
+++ b/winsup/cygwin/fhandler.h
|
||||
@@ -1941,6 +1941,8 @@ class fhandler_termios: public fhandler_base
|
||||
fh->copy_from (this);
|
||||
return fh;
|
||||
}
|
||||
+ static bool path_iscygexec_a (LPCSTR n, LPSTR c);
|
||||
+ static bool path_iscygexec_w (LPCWSTR n, LPWSTR c);
|
||||
};
|
||||
|
||||
enum ansi_intensity
|
||||
diff --git a/winsup/cygwin/fhandler_console.cc b/winsup/cygwin/fhandler_console.cc
|
||||
index 996561b..17de688 100644
|
||||
--- a/winsup/cygwin/fhandler_console.cc
|
||||
+++ b/winsup/cygwin/fhandler_console.cc
|
||||
@@ -32,6 +32,7 @@ details. */
|
||||
#include "sync.h"
|
||||
#include "child_info.h"
|
||||
#include "cygwait.h"
|
||||
+#include "winf.h"
|
||||
|
||||
/* Don't make this bigger than NT_MAX_PATH as long as the temporary buffer
|
||||
is allocated using tmp_pathbuf!!! */
|
||||
@@ -3585,10 +3586,32 @@ set_console_title (char *title)
|
||||
debug_printf ("title '%W'", buf);
|
||||
}
|
||||
|
||||
+static bool NO_COPY gdb_inferior_noncygwin = false;
|
||||
+static void
|
||||
+set_console_mode_to_native ()
|
||||
+{
|
||||
+ cygheap_fdenum cfd (false);
|
||||
+ while (cfd.next () >= 0)
|
||||
+ if (cfd->get_major () == DEV_CONS_MAJOR)
|
||||
+ {
|
||||
+ fhandler_console *cons = (fhandler_console *) (fhandler_base *) cfd;
|
||||
+ if (cons->get_device () == cons->tc ()->getntty ())
|
||||
+ {
|
||||
+ termios *cons_ti = &((tty *) cons->tc ())->ti;
|
||||
+ fhandler_console::set_input_mode (tty::native, cons_ti,
|
||||
+ cons->get_handle_set ());
|
||||
+ fhandler_console::set_output_mode (tty::native, cons_ti,
|
||||
+ cons->get_handle_set ());
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
#define DEF_HOOK(name) static __typeof__ (name) *name##_Orig
|
||||
/* CreateProcess() is hooked for GDB etc. */
|
||||
DEF_HOOK (CreateProcessA);
|
||||
DEF_HOOK (CreateProcessW);
|
||||
+DEF_HOOK (ContinueDebugEvent);
|
||||
|
||||
static BOOL WINAPI
|
||||
CreateProcessA_Hooked
|
||||
@@ -3598,6 +3621,9 @@ CreateProcessA_Hooked
|
||||
{
|
||||
if (f & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS))
|
||||
mutex_timeout = 0; /* to avoid deadlock in GDB */
|
||||
+ gdb_inferior_noncygwin = !fhandler_termios::path_iscygexec_a (n, c);
|
||||
+ if (gdb_inferior_noncygwin)
|
||||
+ set_console_mode_to_native ();
|
||||
return CreateProcessA_Orig (n, c, pa, ta, inh, f, e, d, si, pi);
|
||||
}
|
||||
|
||||
@@ -3609,9 +3635,21 @@ CreateProcessW_Hooked
|
||||
{
|
||||
if (f & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS))
|
||||
mutex_timeout = 0; /* to avoid deadlock in GDB */
|
||||
+ gdb_inferior_noncygwin = !fhandler_termios::path_iscygexec_w (n, c);
|
||||
+ if (gdb_inferior_noncygwin)
|
||||
+ set_console_mode_to_native ();
|
||||
return CreateProcessW_Orig (n, c, pa, ta, inh, f, e, d, si, pi);
|
||||
}
|
||||
|
||||
+static BOOL WINAPI
|
||||
+ContinueDebugEvent_Hooked
|
||||
+ (DWORD p, DWORD t, DWORD s)
|
||||
+{
|
||||
+ if (gdb_inferior_noncygwin)
|
||||
+ set_console_mode_to_native ();
|
||||
+ return ContinueDebugEvent_Orig (p, t, s);
|
||||
+}
|
||||
+
|
||||
void
|
||||
fhandler_console::fixup_after_fork_exec (bool execing)
|
||||
{
|
||||
@@ -3631,6 +3669,7 @@ fhandler_console::fixup_after_fork_exec (bool execing)
|
||||
/* CreateProcess() is hooked for GDB etc. */
|
||||
DO_HOOK (NULL, CreateProcessA);
|
||||
DO_HOOK (NULL, CreateProcessW);
|
||||
+ DO_HOOK (NULL, ContinueDebugEvent);
|
||||
}
|
||||
|
||||
// #define WINSTA_ACCESS (WINSTA_READATTRIBUTES | STANDARD_RIGHTS_READ | STANDARD_RIGHTS_WRITE | WINSTA_CREATEDESKTOP | WINSTA_EXITWINDOWS)
|
||||
diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc
|
||||
index d80b530..a35cee0 100644
|
||||
--- a/winsup/cygwin/fhandler_tty.cc
|
||||
+++ b/winsup/cygwin/fhandler_tty.cc
|
||||
@@ -157,6 +157,66 @@ set_switch_to_pcon (HANDLE *in, HANDLE *out, HANDLE *err, bool iscygwin)
|
||||
*err = replace_err->get_output_handle_nat ();
|
||||
}
|
||||
|
||||
+static bool
|
||||
+path_iscygexec_a_w (LPCSTR na, LPSTR ca, LPCWSTR nw, LPWSTR cw)
|
||||
+{
|
||||
+ path_conv path;
|
||||
+ tmp_pathbuf tp;
|
||||
+ char *prog =tp.c_get ();
|
||||
+ if (na)
|
||||
+ {
|
||||
+ __small_sprintf (prog, "%s", na);
|
||||
+ find_exec (prog, path);
|
||||
+ }
|
||||
+ else if (nw)
|
||||
+ {
|
||||
+ __small_sprintf (prog, "%W", nw);
|
||||
+ find_exec (prog, path);
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ if (ca)
|
||||
+ __small_sprintf (prog, "%s", ca);
|
||||
+ else if (cw)
|
||||
+ __small_sprintf (prog, "%W", cw);
|
||||
+ else
|
||||
+ return true;
|
||||
+ char *p = prog;
|
||||
+ char *p1;
|
||||
+ do
|
||||
+ if ((p1 = strchr (p, ' ')) || (p1 = p + strlen (p)))
|
||||
+ {
|
||||
+ p = p1;
|
||||
+ if (*p == ' ')
|
||||
+ {
|
||||
+ *p = '\0';
|
||||
+ find_exec (prog, path);
|
||||
+ *p = ' ';
|
||||
+ p ++;
|
||||
+ }
|
||||
+ else if (*p == '\0')
|
||||
+ find_exec (prog, path);
|
||||
+ }
|
||||
+ while (!path.exists() && *p);
|
||||
+ }
|
||||
+ const char *argv[] = {"", NULL}; /* Dummy */
|
||||
+ av av1;
|
||||
+ av1.setup ("", path, "", 1, argv, false);
|
||||
+ return path.iscygexec ();
|
||||
+}
|
||||
+
|
||||
+bool
|
||||
+fhandler_termios::path_iscygexec_a (LPCSTR n, LPSTR c)
|
||||
+{
|
||||
+ return path_iscygexec_a_w (n, c, NULL, NULL);
|
||||
+}
|
||||
+
|
||||
+bool
|
||||
+fhandler_termios::path_iscygexec_w (LPCWSTR n, LPWSTR c)
|
||||
+{
|
||||
+ return path_iscygexec_a_w (NULL, NULL, n, c);
|
||||
+}
|
||||
+
|
||||
static bool atexit_func_registered = false;
|
||||
static bool debug_process = false;
|
||||
|
||||
@@ -220,37 +280,9 @@ CreateProcessA_Hooked
|
||||
siov->hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
|
||||
}
|
||||
- path_conv path;
|
||||
- tmp_pathbuf tp;
|
||||
- char *prog =tp.c_get ();
|
||||
- if (n)
|
||||
- __small_sprintf (prog, "%s", n);
|
||||
- else
|
||||
- {
|
||||
- __small_sprintf (prog, "%s", c);
|
||||
- char *p = prog;
|
||||
- char *p1;
|
||||
- do
|
||||
- if ((p1 = strchr (p, ' ')) || (p1 = p + strlen (p)))
|
||||
- {
|
||||
- p = p1;
|
||||
- if (*p == ' ')
|
||||
- {
|
||||
- *p = '\0';
|
||||
- find_exec (prog, path);
|
||||
- *p = ' ';
|
||||
- p ++;
|
||||
- }
|
||||
- else if (*p == '\0')
|
||||
- find_exec (prog, path);
|
||||
- }
|
||||
- while (!path.exists() && *p);
|
||||
- }
|
||||
- const char *argv[] = {"", NULL}; /* Dummy */
|
||||
- av av1;
|
||||
- av1.setup ("", path, "", 1, argv, false);
|
||||
+ bool path_iscygexec = fhandler_termios::path_iscygexec_a (n, c);
|
||||
set_switch_to_pcon (&siov->hStdInput, &siov->hStdOutput, &siov->hStdError,
|
||||
- path.iscygexec ());
|
||||
+ path_iscygexec);
|
||||
BOOL ret = CreateProcessA_Orig (n, c, pa, ta, inh, f, e, d, siov, pi);
|
||||
h_gdb_process = pi->hProcess;
|
||||
DuplicateHandle (GetCurrentProcess (), h_gdb_process,
|
||||
@@ -259,7 +291,7 @@ CreateProcessA_Hooked
|
||||
debug_process = !!(f & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS));
|
||||
if (debug_process)
|
||||
mutex_timeout = 0; /* to avoid deadlock in GDB */
|
||||
- if (!atexit_func_registered && !path.iscygexec ())
|
||||
+ if (!atexit_func_registered && !path_iscygexec)
|
||||
{
|
||||
atexit (atexit_func);
|
||||
atexit_func_registered = true;
|
||||
@@ -286,37 +318,9 @@ CreateProcessW_Hooked
|
||||
siov->hStdOutput = GetStdHandle (STD_OUTPUT_HANDLE);
|
||||
siov->hStdError = GetStdHandle (STD_ERROR_HANDLE);
|
||||
}
|
||||
- path_conv path;
|
||||
- tmp_pathbuf tp;
|
||||
- char *prog =tp.c_get ();
|
||||
- if (n)
|
||||
- __small_sprintf (prog, "%W", n);
|
||||
- else
|
||||
- {
|
||||
- __small_sprintf (prog, "%W", c);
|
||||
- char *p = prog;
|
||||
- char *p1;
|
||||
- do
|
||||
- if ((p1 = strchr (p, ' ')) || (p1 = p + strlen (p)))
|
||||
- {
|
||||
- p = p1;
|
||||
- if (*p == ' ')
|
||||
- {
|
||||
- *p = '\0';
|
||||
- find_exec (prog, path);
|
||||
- *p = ' ';
|
||||
- p ++;
|
||||
- }
|
||||
- else if (*p == '\0')
|
||||
- find_exec (prog, path);
|
||||
- }
|
||||
- while (!path.exists() && *p);
|
||||
- }
|
||||
- const char *argv[] = {"", NULL}; /* Dummy */
|
||||
- av av1;
|
||||
- av1.setup ("", path, "", 1, argv, false);
|
||||
+ bool path_iscygexec = fhandler_termios::path_iscygexec_w (n, c);
|
||||
set_switch_to_pcon (&siov->hStdInput, &siov->hStdOutput, &siov->hStdError,
|
||||
- path.iscygexec ());
|
||||
+ path_iscygexec);
|
||||
BOOL ret = CreateProcessW_Orig (n, c, pa, ta, inh, f, e, d, siov, pi);
|
||||
h_gdb_process = pi->hProcess;
|
||||
DuplicateHandle (GetCurrentProcess (), h_gdb_process,
|
||||
@@ -325,7 +329,7 @@ CreateProcessW_Hooked
|
||||
debug_process = !!(f & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS));
|
||||
if (debug_process)
|
||||
mutex_timeout = 0; /* to avoid deadlock in GDB */
|
||||
- if (!atexit_func_registered && !path.iscygexec ())
|
||||
+ if (!atexit_func_registered && !path_iscygexec)
|
||||
{
|
||||
atexit (atexit_func);
|
||||
atexit_func_registered = true;
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
From 2256476a14cb45c594013d33934ed1ac83240f50 Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Yano <takashi.yano@nifty.ne.jp>
|
||||
Date: Sun, 13 Feb 2022 17:11:02 +0900
|
||||
Subject: [PATCH 44/N] Cygwin: console: Set console mode even if stdin/stdout
|
||||
is redirected.
|
||||
|
||||
- When non-cygwin app is started in console, console mode is set to
|
||||
tty::native. However, if stdin is redirected, current code does not
|
||||
set the input mode of the console. In this case, if the app opens
|
||||
"CONIN$", the console mode will not be appropriate for non-cygwin
|
||||
app. This patch fixes the issue.
|
||||
|
||||
Addresses:
|
||||
https://github.com/GitCredentialManager/git-credential-manager/issues/576
|
||||
---
|
||||
winsup/cygwin/spawn.cc | 19 +++++++------------
|
||||
1 file changed, 7 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
|
||||
index d7ee5fe..434a4a0 100644
|
||||
--- a/winsup/cygwin/spawn.cc
|
||||
+++ b/winsup/cygwin/spawn.cc
|
||||
@@ -657,23 +657,18 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv,
|
||||
}
|
||||
else if (fh && fh->get_major () == DEV_CONS_MAJOR)
|
||||
{
|
||||
- fhandler_console *cons = (fhandler_console *) fh;
|
||||
- if (!iscygwin ())
|
||||
+ if (!iscygwin () && cons_native == NULL)
|
||||
{
|
||||
- if (cons_native == NULL)
|
||||
- {
|
||||
- cons_native = cons;
|
||||
- cons_ti = &((tty *)cons->tc ())->ti;
|
||||
- cons_owner = cons->get_owner ();
|
||||
- }
|
||||
+ fhandler_console *cons = (fhandler_console *) fh;
|
||||
+ cons_native = cons;
|
||||
+ cons_ti = &((tty *)cons->tc ())->ti;
|
||||
+ cons_owner = cons->get_owner ();
|
||||
tty::cons_mode conmode =
|
||||
(ctty_pgid && ctty_pgid == myself->pgid) ?
|
||||
tty::native : tty::restore;
|
||||
- if (fd == 0)
|
||||
- fhandler_console::set_input_mode (conmode,
|
||||
+ fhandler_console::set_input_mode (conmode,
|
||||
cons_ti, cons->get_handle_set ());
|
||||
- else if (fd == 1 || fd == 2)
|
||||
- fhandler_console::set_output_mode (conmode,
|
||||
+ fhandler_console::set_output_mode (conmode,
|
||||
cons_ti, cons->get_handle_set ());
|
||||
}
|
||||
}
|
||||
--
|
||||
2.35.1
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
pkgbase=msys2-runtime
|
||||
pkgname=('msys2-runtime' 'msys2-runtime-devel')
|
||||
pkgver=3.3.4
|
||||
pkgrel=1
|
||||
pkgrel=2
|
||||
pkgdesc="Cygwin POSIX emulation engine"
|
||||
arch=('i686' 'x86_64')
|
||||
url="https://www.cygwin.com/"
|
||||
@ -59,43 +59,61 @@ source=('msys2-runtime'::git://sourceware.org/git/newlib-cygwin.git#tag=cygwin-$
|
||||
0032-docs-skip-building-texinfo-and-PDF-files.patch
|
||||
0033-install-libs-depend-on-the-toollibs.patch
|
||||
0034-POSIX-ify-the-SHELL-variable.patch
|
||||
0035-Handle-ORIGINAL_PATH-just-like-PATH.patch)
|
||||
0035-Handle-ORIGINAL_PATH-just-like-PATH.patch
|
||||
0036-Cygwin-console-Maintain-ENABLE_-INSERT-QUICK_EDIT-_M.patch
|
||||
0037-Cygwin-pty-console-Fix-Ctrl-C-handling-for-non-cygwi.patch
|
||||
0038-Cygwin-pty-Pass-Ctrl-Z-EOF-to-non-cygwin-apps-with-d.patch
|
||||
0039-Cygwin-pty-Prevent-deadlock-on-echo-output.patch
|
||||
0040-Cygwin-pty-Revise-the-code-to-wait-for-completion-of.patch
|
||||
0041-Cygwin-pty-Discard-input-in-from_master_nat-pipe-on-.patch
|
||||
0042-Cygwin-pty-Fix-a-bug-in-tty_min-segpgid.patch
|
||||
0043-Cygwin-console-Fix-console-mode-for-non-cygwin-infer.patch
|
||||
0044-Cygwin-console-Set-console-mode-even-if-stdin-stdout.patch)
|
||||
sha256sums=('SKIP'
|
||||
'64ac070b68e31a8312f6fe4aeb5bebd578ffa38cccc9f4ff195e54602fe7ce1d'
|
||||
'3667a48778037871e108e30ae655857b1af1e55f64b3bbfbaece18225919588b'
|
||||
'b5f0dfb780c67f612da0aef974e08426b0d54d6b94dd0225122d874e25a3867b'
|
||||
'4ad77dae3a531e66552514c04c113c11f2a01fe77ab06b873eeb7cc249080222'
|
||||
'd670261158abb93b6e83240d09e91aace3e72138eff4f315baa8dd83dbcd3f9f'
|
||||
'564b3cfb96639c85ec0c61239b95ac7ac830f5ced482cfbcc57cbbe782436505'
|
||||
'f4e1d7d6941856435aef5c5062d74b85369b12790ea1c70da0f52a883fa2bc8b'
|
||||
'8891230aeb863340fb401c8d44f38486730f064a03ca5c4e8eaf262351340dfa'
|
||||
'cf412757351261a83ab950e2c75663f345b1dbc4bef22e2af59a9d768e8d6297'
|
||||
'bc2eaf1396d55f03651cd4c3b642c7337ad457f36be7db4ecf379ab25cd4460d'
|
||||
'6ecf33a61dcc7b1e9ad58d5b4e32663010e3f7671119ecfae6ef320417fde2fd'
|
||||
'0a11e91381a5a5c26fa3fe6ff532f706e0791539578e0f1544fd3bbfa51064a3'
|
||||
'31d30b47f159c36fb63d98fed583d8adc79c9c6690419dd329e1fe4d50a96e07'
|
||||
'7152b812b154fba8264ef591fbacd8f106f37e7ebaf460a3b196261334f655d1'
|
||||
'1b20a6321e7565fe3b0f48c30fc89ff5eab73368e6dc85916f1db474f9e7bf5e'
|
||||
'e627ad17c4026923536d9d6af4ca4b510f068c6328daf5fb7cec94dfa056a070'
|
||||
'3af75bf35c98a9b12168bdde1850564fdfd20d5ea57ffa9036ced0a4ec7789a9'
|
||||
'a1c9ded94c02663e70fdcf047f723be026212fc57895a054504d6aae520b097f'
|
||||
'ccdc3d68792f9127233323dd4533a1d5577c6039ae3144cb7f38da50af178f7c'
|
||||
'a1a3be713cdf9ba93d810f8cd71f4865d2b28831242e4a28884fdf6327a63ebf'
|
||||
'589b01a5a0f977e3aaaaffb9df9c1d823cced5f1cc00e777fd8efbef605656b1'
|
||||
'df3b0b3f407a2e12539ea2b07d98074b73ef6f1d170c50df8c5ba6c8ca3df46e'
|
||||
'cfbdae560c4575b34b99e33fc91fc41163f36155bee94d212cf3eaf3d87c23b9'
|
||||
'cf211e17bace749544473f794be2894a1a17a4642811c10f8c0fee2566b705bc'
|
||||
'd56f1ca191002a0d24b3154143d28bfce00af5a02b7cf05a972645fcf0144e48'
|
||||
'6d0ea8e208a97ec8bc6de20368442be4eb2f99988af554ce5cf7697ba41c7a47'
|
||||
'e97a19deabce74ac3132df2081fcda7b132d89bbd31d7b3abb302f3a450d9857'
|
||||
'73c6512d09bbf0173c27cd8c406df61ccedfcf128009bc04f0cc39f548e043fc'
|
||||
'573df1c91bf3572988a3f2572227f9011f04f00fbd2fc5c6f17d14f6d7787840'
|
||||
'1a2eb4159f09e234237b2f2e85f194b4e83187c5ac5732ed49dceea67c6f454f'
|
||||
'7c11bf3a47d807dcf88a6a9dd0216fbaa35f1828b066bf017594817f69288f5e'
|
||||
'5de4086c8d50aef52f2f913b6d5422e8a708697b6e0d3a14b8eb5b1d1edc6edb'
|
||||
'5d6e53014407ed0982d5a22fcf32ddd3f448779215df0f9f95eb5ba43662d72b'
|
||||
'f274641faab366f6f0d5a53f68147755186cead3dbfbc95eb388b783b4d97b39'
|
||||
'0fc0bdbd1dc26bd3050b9ab889dab1a53c69a3d6a7d25cf0581a21c518a03fed')
|
||||
'10cdf6ef3dac311175d9a56df8907c449cf5c32f99f0ec797e2a85d05ed86cf0'
|
||||
'1101a29140b733cabc34fd0a0e222c2ddc629143eaf46fc0c4a219a1b9687e06'
|
||||
'1cd177b887135fc6427ebbe3fd9670cfd3560bdb6b05ab343f2da40b10eb5933'
|
||||
'fd8f4875021bb957c79bdde10a913de87794da740772bf78628eb4f3b81e3544'
|
||||
'b740f66d2fd2ba4e9bbea385e2291b75f4ab29efee87449ba1e27a4bdd7f3782'
|
||||
'6c6733a94c53916184a68cfe9951f6767f4827dda28212194697779eb882a36f'
|
||||
'ecbc0dc30bee67c3b46bfc4ace5114caa66b7b3633f2aba3ad798eb48f69e761'
|
||||
'4f7d3e34b861816bf4d5adce27746c2f5be45e2ec3c602ff9a43895d5d9e625f'
|
||||
'9ae673704bfd0c4db81ad2fea2f655e5d45d96aa73660b4bb54665ba2dd50717'
|
||||
'ae46a7b7f319b3e27cb0d01d6409005289c686e10b5ded073126c1037cd4e291'
|
||||
'033c1fbce111f01a1a8d6dae65f613bb50c43346f6dadd09cad190cac47e5a19'
|
||||
'38e16161ef9ee153d79210dfaa271e005eeb92af92295544e07d233cba6dae51'
|
||||
'f22718588e6d71b02dcb7a2bf08e19f21b34a4f0b9bbdc54207dc6f95263c245'
|
||||
'a8d289b19e349231bc5d56110ac37c8b8298f23fc54a6953e3540a9fd53a1945'
|
||||
'25c3b8c1be139cc7aa81be1209666538f1ccbae5fc6ede8358483f8d13e8403f'
|
||||
'3054f29188b32fba5e242e3c6c79ee681c591ad9acddcce47a91ef8dc684c239'
|
||||
'3732b6121792d691c9eb62ac9962fb837851506c95f0d6c2cd11b73cc3a329d7'
|
||||
'35b0bdc4689edf02de1447f3d1372651d512669a31808bedd4167e8769aaa930'
|
||||
'7f1854337525c6fbfe0e231c0fdd369baa81c7cbb4fe62fde88b275d2b6f84dd'
|
||||
'f0a7b54cb811760d47038c5e2de268a2cf2f62a104426a22ef29510c96f936ee'
|
||||
'4fc1e115954d642f44dde63673b31ca3e3b0b881bd0c411fdd159bdb638f92e7'
|
||||
'd201ac342352056d0f43609867bccd9acec8ba04db49f26d6b2e70803e8454cf'
|
||||
'8585d541e6e85a1c0a91b41851f91f806d88801ac55649e08434f149827132b5'
|
||||
'86c79e134effecce7baeee8e8eeb23d1f6d2774ca3bacaad666bfa68725d6d15'
|
||||
'347cc681272a20f74a2045ebed900a7b4dd5c802b61f7039436eaf6d5ac34230'
|
||||
'1717320182e77f8dc2a07bd77db027aec18c1d0a9d325224dc4e4e3e8b91d46f'
|
||||
'3c635d435b9bc7b639df8429aafee288efe658a6f0027c512b0f3a3531c75c24'
|
||||
'8fe4ce14eeb6d1fae97e611d74a19e8beb81dfbdc7e8d8d5f570bcd7ed2ddcf9'
|
||||
'6d8867b439699da05613a26b0329861da0ccaec9607b3341aaa4404f6c929287'
|
||||
'd9d4b1fc14eb209566201b420b89253c5a44be205c56c281df197c666c43a049'
|
||||
'e404746383dddc064f9cdc82573474217a22c0b4573da16445b0bb19adbd66b7'
|
||||
'bf0d5ac6d605c0503ecefad24b3ea4e54dfffa1ac4b003a50c02732b99303aef'
|
||||
'6097138f0af30de2562304e3ba9e822ef8eecafc050fe1a1661cfbe269abd70d'
|
||||
'9980074cbf1bcf19f45988ed260cb0f67569115f1de8ffc86aade0ec4d521458'
|
||||
'e69fb7620df519a33750675fd904fcc0773181b5a8bdbb15dad2f078456f7cd5'
|
||||
'f8624618db21cd8bf8f4c66f2418d47e73d9335d537ce5cdcc2d79f726585733'
|
||||
'eb50b49f9f0d523ef8023c73f8108b3b3fc5db47e8c6feb941c75cf23466a81f'
|
||||
'e114f753644165454ec1687a6713a6efea0523b1bb378fa2158eb4691e2136a3'
|
||||
'4c71b30d61de6fafa8e334e182d539b5df6baa4d9fbbbb0221a56b72974b9135'
|
||||
'4a8822cb2e0e7096449ab039c3c4ca7f121468a5efdda7dddb82c04147d3ae73'
|
||||
'7a3ae231c1222ba4c971e5cd7a83e665227256fa4d76078986f78e5d864f5509'
|
||||
'fefc75a87cbc52ac7439e45c9fe9f9d1dedbfa1bb7898f2472dffbb3beb345f1'
|
||||
'd74d30671080b154235cb49c87de06727c1250304993e298036f74f4cdca4301'
|
||||
'a590b6902fdd1804318a85b8ccb0c0e79baa4b17fe81047fc5e8374438ad6912')
|
||||
|
||||
# Helper macros to help make tasks easier #
|
||||
apply_patch_with_msg() {
|
||||
@ -167,7 +185,16 @@ prepare() {
|
||||
0032-docs-skip-building-texinfo-and-PDF-files.patch \
|
||||
0033-install-libs-depend-on-the-toollibs.patch \
|
||||
0034-POSIX-ify-the-SHELL-variable.patch \
|
||||
0035-Handle-ORIGINAL_PATH-just-like-PATH.patch
|
||||
0035-Handle-ORIGINAL_PATH-just-like-PATH.patch \
|
||||
0036-Cygwin-console-Maintain-ENABLE_-INSERT-QUICK_EDIT-_M.patch \
|
||||
0037-Cygwin-pty-console-Fix-Ctrl-C-handling-for-non-cygwi.patch \
|
||||
0038-Cygwin-pty-Pass-Ctrl-Z-EOF-to-non-cygwin-apps-with-d.patch \
|
||||
0039-Cygwin-pty-Prevent-deadlock-on-echo-output.patch \
|
||||
0040-Cygwin-pty-Revise-the-code-to-wait-for-completion-of.patch \
|
||||
0041-Cygwin-pty-Discard-input-in-from_master_nat-pipe-on-.patch \
|
||||
0042-Cygwin-pty-Fix-a-bug-in-tty_min-segpgid.patch \
|
||||
0043-Cygwin-console-Fix-console-mode-for-non-cygwin-infer.patch \
|
||||
0044-Cygwin-console-Set-console-mode-even-if-stdin-stdout.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user