public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Thomas Wolff <towo@towo.net>
To: cygwin-developers@cygwin.com
Subject: Re: [PATCH v6 1/1] Cygwin: pty: add pseudo console support.
Date: Tue, 13 Aug 2019 21:14:00 -0000	[thread overview]
Message-ID: <a623a13e-654f-f06c-a3f9-98daab4fddf2@towo.net> (raw)
In-Reply-To: <20190813001118.fbbbed4d2b3e700609b74df6@nifty.ne.jp>

[-- Attachment #1: Type: text/plain, Size: 2095 bytes --]

Am 12.08.2019 um 17:11 schrieb Takashi Yano:
> On Mon, 12 Aug 2019 15:44:05 +0200
> Thomas Wolff wrote:
>> I'd like to test your patch again, but if fails to apply to the current
>> master version for me.
>> Can you please tell us the commit (of newlib-cygwin/winsup) the patch is
>> based on, so it can simply be applied for testing?
> I confirmed this patch can be applied to:
> 744b90c9963cac8dbe62d8970f145e53b927d4e6
I've now retested conpty v6 and it has much improved since the previous 
version I tested, thank you very much.
The only 2 issues that I still observe are that character set conversion 
within a terminal is hard-targeted towards UTF-8, and one case of input 
stalling when using ReadConsole from a cygwin-compiled program.

Test results:

resize terminal while running Windows cmd
✓works
run cmd, run dir/P: works

signal handling/mediation
✓^Z is properly caught e.g. when running notepad

character set conversion from Windows cmd line program
✓works: xcopy (→ German error message)
↯non-ASCII output fails in non-Unicode mintty

The following cases refer to wincon.c, compiled with x86_64-w64-mingw32-gcc:
output: WriteConsoleW
✓works in Unicode mintty
↯non-ASCII output fails in non-Unicode mintty
output: SetConsoleTextAttribute character attributes
✓works
input: ReadConsoleW
✓works in Unicode mintty

The same program, compiled with cygwin gcc, fails in mintty:
output is skipped (like without the patch)
↯input stalls, kill -9 fails.
Without conpty patch v6, both output and input are skipped.
Note that winpty properly handles this case.

handling non-ASCII characters
↯fails in cmd within non-Unicode mintty (LC_ALL=en_US mintty)
(echo ö, or type file with a properly encoded ö)
but does not stall anymore...

terminal reports in response to request escape sequences
("\033[6n", "\033[0c", "\033[>c", '\033[18t', '\033]10;?\033\')
✓work

output to alternate screen
✓seems to work
before or while cmd.exe is running, echo "\033[?1047h" > /dev/pty...
to mintty from somewhere else, run dir...


[-- Attachment #2: wincon.c --]
[-- Type: text/plain, Size: 705 bytes --]

#include <locale.h>
#include <wchar.h>
#include <stdio.h>
#include <windows.h>

void main()
{
  setlocale(LC_CTYPE, "");
  wchar_t * s = u"bäh 3€ 啕\n";
  HANDLE conout = GetStdHandle(STD_OUTPUT_HANDLE);
  DWORD len;

  printf("WriteConsole:\n");
  WriteConsoleW(conout, s, wcslen(s), &len, 0);

  printf("SetConsoleTextAttribute:\n");
  SetConsoleTextAttribute(conout, FOREGROUND_GREEN);
  WriteConsoleW(conout, s, wcslen(s), &len, 0);

  wchar_t buf[99];
  HANDLE conin = GetStdHandle(STD_INPUT_HANDLE);
  printf("ReadConsole:\n");
  ReadConsoleW(conin, buf, 9, &len, 0);
  buf[len] = 0;
  DWORD len1;
  WriteConsoleW(conout, buf, len, &len1, 0);
  printf("printf (%d chars): <%ls>\n", len, buf);
}

  parent reply	other threads:[~2019-08-13 21:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-12 12:10 [PATCH v6 0/1] Pseudo console support in PTY (v6) Takashi Yano
2019-08-12 12:10 ` [PATCH v6 1/1] Cygwin: pty: add pseudo console support Takashi Yano
2019-08-12 13:44   ` Thomas Wolff
2019-08-12 14:57     ` Corinna Vinschen
2019-08-12 15:11     ` Takashi Yano
2019-08-12 15:37       ` Corinna Vinschen
2019-08-12 15:44         ` Takashi Yano
2019-08-12 18:25           ` Corinna Vinschen
2019-08-13 21:14       ` Thomas Wolff [this message]
2019-08-15 16:08         ` Takashi Yano
2019-08-15 18:22           ` Thomas Wolff

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=a623a13e-654f-f06c-a3f9-98daab4fddf2@towo.net \
    --to=towo@towo.net \
    --cc=cygwin-developers@cygwin.com \
    /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: link
Be 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).