[PATCH 0/1] Cygwin: pty: Fix potential state mismatch regarding pseudo console.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/1] Cygwin: pty: Fix potential state mismatch regarding pseudo console.

Takashi Yano
- PTY with pseudo console support sitll has problem which potentially
  cause state mismatch between state variable and real console state.
  This patch fixes this issue.

Takashi Yano (1):
  Cygwin: pty: Fix potential state mismatch regarding pseudo console.

 winsup/cygwin/dtable.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

--
2.21.0

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/1] Cygwin: pty: Fix potential state mismatch regarding pseudo console.

Takashi Yano
- PTY with pseudo console support sitll has problem which potentially
  cause state mismatch between state variable and real console state.
  This patch fixes this issue.
---
 winsup/cygwin/dtable.cc | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
index 4e9b6ed56..7b2e52005 100644
--- a/winsup/cygwin/dtable.cc
+++ b/winsup/cygwin/dtable.cc
@@ -159,14 +159,19 @@ dtable::stdio_init ()
     {
       bool attached = !!fhandler_console::get_console_process_id
  (ptys->getHelperProcessId (), true);
-      if (!attached)
+      if (attached)
+ break;
+      else
  {
   /* Not attached to pseudo console in fork() or spawn()
      by some reason. This happens if the executable is
      a windows GUI binary, such as mintty. */
   FreeConsole ();
   if (AttachConsole (ptys->getHelperProcessId ()))
-    break;
+    {
+      ptys->fixup_after_attach (false);
+      break;
+    }
  }
     }
  }
--
2.21.0

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 1/1] Cygwin: pty: Fix potential state mismatch regarding pseudo console.

Corinna Vinschen-2
On Sep  5 19:44, Takashi Yano wrote:

> - PTY with pseudo console support sitll has problem which potentially
>   cause state mismatch between state variable and real console state.
>   This patch fixes this issue.
> ---
>  winsup/cygwin/dtable.cc | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc
> index 4e9b6ed56..7b2e52005 100644
> --- a/winsup/cygwin/dtable.cc
> +++ b/winsup/cygwin/dtable.cc
> @@ -159,14 +159,19 @@ dtable::stdio_init ()
>      {
>        bool attached = !!fhandler_console::get_console_process_id
>   (ptys->getHelperProcessId (), true);
> -      if (!attached)
> +      if (attached)
> + break;
> +      else
>   {
>    /* Not attached to pseudo console in fork() or spawn()
>       by some reason. This happens if the executable is
>       a windows GUI binary, such as mintty. */
>    FreeConsole ();
>    if (AttachConsole (ptys->getHelperProcessId ()))
> -    break;
> +    {
> +      ptys->fixup_after_attach (false);
> +      break;
> +    }
>   }
>      }
>   }
> --
> 2.21.0
Pushed.

FYI, Ken Brown is taking over from here as temporary co-maintainer for
Cygwin.  He'll build and upload Cygwin test releases during my absence.
Please don't hesitate to send more patches as required, Ken will review
and eventually push them.

Ken, if you like, please generate a new Cygwin test release now.


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer

signature.asc (849 bytes) Download Attachment