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

2019-09-02 Thread Ken Brown
On 9/1/2019 5:53 PM, Takashi Yano wrote:
> Hi Ken,
> 
> Thank you for testing.
> 
> On Sun, 1 Sep 2019 15:13:47 +
> Ken Brown wrote:
>> On 8/31/2019 6:54 PM, 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
>>> pipe switching. This patch fixes this issue by redesigning the
>>> state management.
>>
>> After applying this patch, I get the following in mintty:
>>
>> $ cygcheck -cd | grep bash
>> grep: write error: Bad file descriptor
>>
>> Further commands after that lead to the cursor jumping around.
> 
> I have fixed this problem. I will post it as v3 patch soon.
> 
>> Here's a second glitch I've noticed (starting with commit
>> 169d65a5774acc76ce3f3feeedcbae7405aa9b57): In emacs, if I run a command that
>> uses compilation mode, the output displayed in the compilation buffer starts
>> with ^[[H^[[J.  Here ^[ is the escape character, so this is apparently the 
>> two
>> ANSI escape sequences ESC[H and ESC[J.
>>
>> Sample commands that use compilation mode are 'M-x compile', 'M-x rgrep', and
>> 'M-x find-name-directory'.  I can provide more detailed reproduction
>> instructions if you're not an emacs user.
> 
> Hmmm, it seems that ANSI escape sequences are not recognized in emacs.
> 
>> 'M-x find-name-directory'
> Do you mean find-name-dired ?

Yes.

Ken


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

2019-09-01 Thread Takashi Yano
Hi Ken,

Thank you for testing.

On Sun, 1 Sep 2019 15:13:47 +
Ken Brown wrote:
> On 8/31/2019 6:54 PM, 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
> > pipe switching. This patch fixes this issue by redesigning the
> > state management.
> 
> After applying this patch, I get the following in mintty:
> 
> $ cygcheck -cd | grep bash
> grep: write error: Bad file descriptor
> 
> Further commands after that lead to the cursor jumping around.

I have fixed this problem. I will post it as v3 patch soon.

> Here's a second glitch I've noticed (starting with commit 
> 169d65a5774acc76ce3f3feeedcbae7405aa9b57): In emacs, if I run a command that 
> uses compilation mode, the output displayed in the compilation buffer starts 
> with ^[[H^[[J.  Here ^[ is the escape character, so this is apparently the 
> two 
> ANSI escape sequences ESC[H and ESC[J.
> 
> Sample commands that use compilation mode are 'M-x compile', 'M-x rgrep', and 
> 'M-x find-name-directory'.  I can provide more detailed reproduction 
> instructions if you're not an emacs user.

Hmmm, it seems that ANSI escape sequences are not recognized in emacs.

> 'M-x find-name-directory'
Do you mean find-name-dired ?

-- 
Takashi Yano 


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

2019-09-01 Thread Ken Brown
Hi Takashi,

On 8/31/2019 6:54 PM, 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
> pipe switching. This patch fixes this issue by redesigning the
> state management.

After applying this patch, I get the following in mintty:

$ cygcheck -cd | grep bash
grep: write error: Bad file descriptor

Further commands after that lead to the cursor jumping around.

Here's a second glitch I've noticed (starting with commit 
169d65a5774acc76ce3f3feeedcbae7405aa9b57): In emacs, if I run a command that 
uses compilation mode, the output displayed in the compilation buffer starts 
with ^[[H^[[J.  Here ^[ is the escape character, so this is apparently the two 
ANSI escape sequences ESC[H and ESC[J.

Sample commands that use compilation mode are 'M-x compile', 'M-x rgrep', and 
'M-x find-name-directory'.  I can provide more detailed reproduction 
instructions if you're not an emacs user.

I can also try to make an STC, but that will take me longer.

Ken


[PATCH v2 0/1] Fix PTY state management in pseudo console support.

2019-08-31 Thread Takashi Yano
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
pipe switching. This patch fixes this issue by redesigning the
state management.

v2:
Small bug fixed from v1.

Takashi Yano (1):
  Cygwin: pty: Fix state management for pseudo console support.

 winsup/cygwin/dtable.cc   |  15 +-
 winsup/cygwin/fhandler.h  |   6 +-
 winsup/cygwin/fhandler_console.cc |   6 +-
 winsup/cygwin/fhandler_tty.cc | 404 --
 winsup/cygwin/fork.cc |  24 +-
 winsup/cygwin/spawn.cc|  65 ++---
 6 files changed, 283 insertions(+), 237 deletions(-)

-- 
2.21.0