[PATCH 1/1] Cygwin: pty: Fix select() with pseudo console support.

2019-09-04 Thread Takashi Yano
- select() did not work correctly when both read and except are polled simultaneously for the same fd and the r/w pipe is switched to pseudo console side. This patch fixes this isseu. --- winsup/cygwin/fhandler.h | 15 +++ winsup/cygwin/fhandler_tty.cc | 13 ++- winsup/cygwin/select.cc

[PATCH 0/1] Cygwin: pty: Fix select() with pseudo console support.

2019-09-04 Thread Takashi Yano
- select() did not work correctly when both read and except are polled simultaneously for the same fd and the r/w pipe is switched to pseudo console side. This patch fixes this isseu. Takashi Yano (1): Cygwin: pty: Fix select() with pseudo console support. winsup/cygwin/fhandler.h |

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Brian Inglis
On 2019-09-04 19:13, Takashi Yano wrote: > On Wed, 4 Sep 2019 11:22:42 -0600 > Brian Inglis wrote: >> That output seems to be generated by a shell or program running in the pty. >> If the recipient can not handle escape sequences, then the shell or program >> in >> the pty should be configured by

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Takashi Yano
On Wed, 4 Sep 2019 11:22:42 -0600 Brian Inglis wrote: > That output seems to be generated by a shell or program running in the pty. > If the recipient can not handle escape sequences, then the shell or program in > the pty should be configured by setting e.g. TERM=dumb when launching the >

[PATCH v2 1/1] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Takashi Yano
- Pseudo console support introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57 shows garbage ^[[H^[[J in some of emacs screens. These screens do not handle ANSI escape sequences. Therefore, clear screen is disabled on these screens. --- winsup/cygwin/fhandler_tty.cc | 19

[PATCH v2 0/1] Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Takashi Yano
- Pseudo console support introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57 shows garbage ^[[H^[[J in some of emacs screens. These screens do not handle ANSI escape sequences. Therefore, clear screen is disabled on these screens. v2: Remove check for TERM in fixup_after_attach().

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Brian Inglis
On 2019-09-03 21:45, Takashi Yano wrote: > On Wed, 4 Sep 2019 12:34:31 +0900 > Takashi Yano wrote: >> Attached is the raw output from pseudo console when the screen shows >> the simple text below. >> >> from here >> [yano@Express5800-S70 ~]$ cmd >> Microsoft Windows [Version

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Takashi Yano
On Wed, 4 Sep 2019 17:19:05 +0200 Corinna Vinschen wrote: > > But the first check (the one in fixup_after_attach()) could be dropped, > > couldn't it? > > IIUC the second test first checks for need_clear_screen but then the > TERM might have changed in the meantime which in turn requires to

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Corinna Vinschen
On Sep 4 15:11, Ken Brown wrote: > On 9/4/2019 10:42 AM, Takashi Yano wrote: > > On Wed, 4 Sep 2019 15:55:03 +0200 > > Corinna Vinschen wrote: > >> The code in fixup_after_attach() is the only code snippet setting > >> need_clear_screen = true. And that code also requires term != "dump" && > >>

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Ken Brown
On 9/4/2019 10:42 AM, Takashi Yano wrote: > On Wed, 4 Sep 2019 15:55:03 +0200 > Corinna Vinschen wrote: >> The code in fixup_after_attach() is the only code snippet setting >> need_clear_screen = true. And that code also requires term != "dump" && >> term == "*emacs*" to set need_clear_screen. >

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Takashi Yano
On Wed, 4 Sep 2019 15:55:03 +0200 Corinna Vinschen wrote: > The code in fixup_after_attach() is the only code snippet setting > need_clear_screen = true. And that code also requires term != "dump" && > term == "*emacs*" to set need_clear_screen. term != "*emacs*" > The code in

Re: [PATCH v2 0/1] Cygwin: pty: Add a workaround for ^C handling.

2019-09-04 Thread Corinna Vinschen
On Sep 4 22:47, Takashi Yano wrote: > - Pseudo console support introduced by commit > 169d65a5774acc76ce3f3feeedcbae7405aa9b57 sometimes cause random > crash or freeze by pressing ^C while cygwin and non-cygwin > processes are executed simultaneously in the same pty. This > patch is a

Re: [PATCH v2 1/1] Cygwin: pty: Limit API hook to the program linked with the APIs.

2019-09-04 Thread Corinna Vinschen
On Sep 4 22:46, Takashi Yano wrote: > - API hook used for pseudo console support causes slow down. > This patch limits API hook to only program which is linked > with the corresponding APIs. Normal cygwin program is not > linked with such APIs (such as WriteFile, etc...) directly, >

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Corinna Vinschen
On Sep 4 21:49, Takashi Yano wrote: > On Wed, 4 Sep 2019 12:47:38 +0200 > Corinna Vinschen wrote: > > Why do you check the TERMs again here? After all, need_clear_screen > > is only true if one of these terms are used. > > Because, emacs seems to set environment TERM after fixup_after_exec() >

[PATCH v2 1/1] Cygwin: pty: Add a workaround for ^C handling.

2019-09-04 Thread Takashi Yano
- Pseudo console support introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57 sometimes cause random crash or freeze by pressing ^C while cygwin and non-cygwin processes are executed simultaneously in the same pty. This patch is a workaround for this issue. ---

[PATCH v2 0/1] Cygwin: pty: Add a workaround for ^C handling.

2019-09-04 Thread Takashi Yano
- Pseudo console support introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57 sometimes cause random crash or freeze by pressing ^C while cygwin and non-cygwin processes are executed simultaneously in the same pty. This patch is a workaround for this issue. v2: Make the behaviour

[PATCH v2 1/1] Cygwin: pty: Limit API hook to the program linked with the APIs.

2019-09-04 Thread Takashi Yano
- API hook used for pseudo console support causes slow down. This patch limits API hook to only program which is linked with the corresponding APIs. Normal cygwin program is not linked with such APIs (such as WriteFile, etc...) directly, therefore, no slow down occurs. However, console

[PATCH v2 0/1] Cygwin: pty: Limit API hook to the program linked with the APIs.

2019-09-04 Thread Takashi Yano
- API hook used for pseudo console support causes slow down. This patch limits API hook to only program which is linked with the corresponding APIs. Normal cygwin program is not linked with such APIs (such as WriteFile, etc...) directly, therefore, no slow down occurs. However, console

Re: [PATCH 1/2] Cygwin: pty: Add a workaround for ^C handling.

2019-09-04 Thread Corinna Vinschen
On Sep 4 22:30, Takashi Yano wrote: > On Wed, 4 Sep 2019 12:42:22 +0200 > Corinna Vinschen wrote: > > If this workaround works, what about making it the standard behaviour, > > rather than pseudo-console only? Would there be a downside? > > I am not sure why, but console does not have this

Re: [PATCH 4/4] Cygwin: pty: Limit API hook to the program linked with the APIs.

2019-09-04 Thread Corinna Vinschen
Hi Takashi, On Sep 4 21:39, Takashi Yano wrote: > Hi Corinna, > > On Wed, 4 Sep 2019 12:03:51 +0200 > Corinna Vinschen wrote: > > I'll push the other 3 patches from this series. For this patch, > > I wonder why you create set_ishybrid_and_switch_to_pcon while > > at the same time define a

Re: [PATCH 1/2] Cygwin: pty: Add a workaround for ^C handling.

2019-09-04 Thread Takashi Yano
On Wed, 4 Sep 2019 12:42:22 +0200 Corinna Vinschen wrote: > If this workaround works, what about making it the standard behaviour, > rather than pseudo-console only? Would there be a downside? I am not sure why, but console does not have this issue. However, I do not notice any downside. If

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Takashi Yano
On Wed, 4 Sep 2019 12:47:38 +0200 Corinna Vinschen wrote: > Why do you check the TERMs again here? After all, need_clear_screen > is only true if one of these terms are used. Because, emacs seems to set environment TERM after fixup_after_exec() is called. At the first check, TERM has the value

Re: [PATCH 4/4] Cygwin: pty: Limit API hook to the program linked with the APIs.

2019-09-04 Thread Takashi Yano
Hi Corinna, On Wed, 4 Sep 2019 12:03:51 +0200 Corinna Vinschen wrote: > I'll push the other 3 patches from this series. For this patch, > I wonder why you create set_ishybrid_and_switch_to_pcon while > at the same time define a macro CHK_CONSOLE_ACCESS with identical > functionality. Yah,

Re: [PATCH 2/2] Cygwin: pty: Disable clear screen on new pty if TERM=dumb or emacs*.

2019-09-04 Thread Corinna Vinschen
On Sep 4 10:46, Takashi Yano wrote: > - Pseudo console support introduced by commit > 169d65a5774acc76ce3f3feeedcbae7405aa9b57 shows garbage ^[[H^[[J in > some of emacs screens. These screens do not handle ANSI escape > sequences. Therefore, clear screen is disabled on these screens. > ---

Re: [PATCH 1/2] Cygwin: pty: Add a workaround for ^C handling.

2019-09-04 Thread Corinna Vinschen
On Sep 4 10:46, Takashi Yano wrote: > - Pseudo console support introduced by commit > 169d65a5774acc76ce3f3feeedcbae7405aa9b57 sometimes cause random > crash or freeze by pressing ^C while cygwin and non-cygwin > processes are executed simultaneously in the same pty. This > patch is a

Re: [PATCH v5 0/1] Fix PTY state management in pseudo console support.

2019-09-04 Thread Corinna Vinschen
On Sep 4 10:45, Takashi Yano wrote: > Pseudo console support in test release TEST: Cygwin 3.1.0-0.3, > introduced by commit 169d65a5774acc76ce3f3feeedcbae7405aa9b57, > has some bugs which cause mismatch between state variables and > real pseudo console state regarding console attaching and r/w >

Re: [PATCH 4/4] Cygwin: pty: Limit API hook to the program linked with the APIs.

2019-09-04 Thread Corinna Vinschen
Hi Takashi, On Sep 4 10:44, Takashi Yano wrote: > - API hook used for pseudo console support causes slow down. > This patch limits API hook to only program which is linked > with the corresponding APIs. Normal cygwin program is not > linked with such APIs (such as WriteFile, etc...)