public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Thomas Wolff <towo@towo.net>
To: cygwin-developers@cygwin.com, Takashi Yano <takashi.yano@nifty.ne.jp>
Subject: Re: [PATCH v3 0/1] Pseudo console support in PTY (v3)
Date: Sun, 07 Apr 2019 21:21:00 -0000	[thread overview]
Message-ID: <4a29b2b9-cf36-7613-fdcc-c9b854de75fe@towo.net> (raw)
In-Reply-To: <20190407140535.83d70ba0ac7f249a87d18dd2@nifty.ne.jp>

Am 07.04.2019 um 07:05 schrieb Takashi Yano:
> Hi Thomas,
>
> Thank you very much for testing.
You're welcome; I'm very interested in this solution, not only, but also 
because the interoperability problems cause a series of problem reports 
to mintty.

> On Sat, 6 Apr 2019 23:33:04 +0200 Thomas Wolff wrote:
> ...
>> Terminal reports "\033[6n" and "\033[0c" are apparently emulated and
>> sent in reverse order;
>> response to primary device attribute request is wrong (not what mintty
>> would report).
>> There is no response to secondary device attribute request ("\033[>0c")
>> and others,
>> e.g. '\033[18t' or '\033]10;?\033\' and many others; why can't these
>> requests be passed to the terminal and handled transparently? (You
>> explained something around handles before but I don't get the point.)
> This is not caused by my intercept, but pseudo console itself.
> Unfortunately, pseudo console is not transparent at all. Pseudo
> console interprets VT100 sequences in output and processes them.
> Then, it fowards another VT100 sequences to the pipe associated
> with the pseudo console.
OK, understood. So ConPTY is not only a pty adapter but also a kind of 
half-terminal emulator, like tmux or screen.

>
>> Output to alternate screen seems to be forced to the primary screen, mostly;
>> if I try to switch screen in various ways (menu, echo "\033[?1047h" >
>> /dev/pty1, before or while cmd.exe runs),
>> behaviour appears to be inconsistent and not as expected (expected
>> behaviour is that any output goes to the active screen).
> Hmmm, this may be caused by "synchronization". I will also check this.
>
>> Again, I don't see a need that you intercept this at all.
> The patch attached disables all my intercept. It is against v3.
> Please check the output from PTY using script command with this
> patch. You can use your test case for the test. You will find many
> VT100 ESC secuenses you don't write to console. These are written
> by pseudo console itself.
OK, I may find time to analyse that. Meanwhile, my test case for the 
above unfortunately still fails with the "disabling" patch:
Start mintty, run `tty`, let's say it says /dev/pty0.
In mintty, run cmd.
In another shell (mintty or not), run echo "\033[?1047h" > /dev/pty0.
In mintty, in cmd, type dir... nothing happens. "dir" will be echoed and 
its output shown in unpatched cygwin.

> Also, you can confirm screen layout is broken if you run cygwin
> apps and native console apps alternately. "Synchronization" is
> necessary to avoid this, I think.
I have not observed any "broken" screen layout, but I notice a cleared 
screen when starting cmd (does not clear in unpatched cygwin). Other 
non-cygwin programs, like java, do not clear the screen. Do you have an 
explanation?

> On Sat, 6 Apr 2019 23:33:04 +0200 Thomas Wolff wrote:
>> Character output conversion works with my test program (using
>> WriteConsoleW). Using java, output works too (with proper java encoding
>> option), but non-ASCII input characters are replaced by and echoed as space.
> Indeed... I will fix it.
> Once, I thought I could reproduce, however, I cannot reproduce this
> now. Could you please let me know how you tested.
I'm attaching my Java test program below.
I compile it with javac -encoding UTF-8 and run it with java 
-Dfile.encoding=UTF-8. This makes non-ASCII output work in a UTF-8 
terminal. Non-ASCII input however is blanked.

Kind regards,
Thomas


import java.io.*;

public class JavaPW
{
   public static void main(String args[]) throws IOException
   {
     System.out.println("Writing Unicode: bäh 3€");

     BufferedReader rd = new BufferedReader(new 
InputStreamReader(System.in, "UTF-8"));
     System.out.println("Reading input from System.in");
     System.out.println("Please enter your input: ");
     String input = rd.readLine();
     System.out.println("User Input from System.in: " + input);

     Console console = System.console();
     System.out.println("Reading input from console");
     System.out.println("Please enter your input: ");
     input = console.readLine();
     System.out.println("User Input from console: " + input);

     System.out.println("Reading password from Console in Java: ");
     //password will not be echoed to console and stored in char array
     char[] password = console.readPassword();
     System.out.println("Password entered by user: " + new 
String(password));
   }
}

      parent reply	other threads:[~2019-04-07 21:21 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-30 13:08 Pseudo console support in PTY Takashi Yano
2019-03-30 19:47 ` Corinna Vinschen
2019-03-30 19:59   ` Corinna Vinschen
2019-03-30 23:07 ` Thomas Wolff
2019-03-31 14:38   ` Corinna Vinschen
2019-03-31 15:00   ` Takashi Yano
2019-04-02 11:02 ` Corinna Vinschen
2019-04-02 17:16   ` Thomas Wolff
2019-04-02 17:51     ` Corinna Vinschen
2019-04-03  7:18       ` Thomas Wolff
2019-04-03  7:28         ` Corinna Vinschen
2019-04-03  7:55           ` Thomas Wolff
2019-04-03  8:02             ` Corinna Vinschen
2019-04-03 11:33               ` Thomas Wolff
2019-04-03 12:17                 ` Corinna Vinschen
2019-04-04  4:17                   ` Takashi Yano
2019-04-04  8:06                     ` Corinna Vinschen
2019-04-04  4:15             ` Takashi Yano
2019-04-03 16:36   ` [PATCH v2 0/1] Pseudo console support in PTY (v2) Takashi Yano
2019-04-03 16:37     ` [PATCH v2 1/1] Cygwin: pty: add pseudo console support Takashi Yano
2019-04-03 16:50     ` [PATCH v2 0/1] Pseudo console support in PTY (v2) Corinna Vinschen
2019-04-04  5:27       ` Takashi Yano
2019-04-04  8:17         ` Thomas Wolff
2019-04-04  9:34           ` Takashi Yano
2019-04-03 17:11     ` Corinna Vinschen
2019-04-04  8:59       ` Takashi Yano
2019-04-04 10:46         ` Corinna Vinschen
2019-04-06 11:13           ` [PATCH v3 0/1] Pseudo console support in PTY (v3) Takashi Yano
2019-04-06 11:14             ` [PATCH v3 1/1] Cygwin: pty: add pseudo console support Takashi Yano
2019-04-06 17:43             ` [PATCH v3 0/1] Pseudo console support in PTY (v3) Corinna Vinschen
2019-04-12 10:22               ` [PATCH v4 0/1] Pseudo console support in PTY (v4) Takashi Yano
2019-04-12 10:23                 ` [PATCH v4 1/1] Cygwin: pty: add pseudo console support Takashi Yano
2019-04-12 12:29                 ` [PATCH v4 0/1] Pseudo console support in PTY (v4) Corinna Vinschen
2019-04-15  8:18                   ` Corinna Vinschen
2019-04-15 23:17                     ` Takashi Yano
2019-04-14 15:23                 ` [PATCH v5 0/1] Pseudo console support in PTY (v5) Takashi Yano
2019-04-14 15:23                   ` [PATCH v5 1/1] Cygwin: pty: add pseudo console support Takashi Yano
2019-04-15  8:38                     ` Corinna Vinschen
2019-04-16  0:41                       ` Takashi Yano
2019-04-16  9:16                         ` Corinna Vinschen
2019-06-24 10:53                           ` Corinna Vinschen
2019-07-25 14:31                             ` Corinna Vinschen
2019-08-08 19:24                               ` Corinna Vinschen
2019-08-12 12:07                             ` Takashi Yano
2019-08-12 12:50                               ` Corinna Vinschen
2019-08-12 14:36                                 ` Takashi Yano
2019-04-14 16:06                   ` [PATCH v5 0/1] Pseudo console support in PTY (v5) Takashi Yano
2019-04-16  1:49                     ` Takashi Yano
2019-04-16  1:51                       ` Takashi Yano
2019-04-06 21:33             ` [PATCH v3 0/1] Pseudo console support in PTY (v3) Thomas Wolff
2019-04-07  5:05               ` Takashi Yano
2019-04-07 12:02                 ` Takashi Yano
2019-04-07 21:21                 ` Thomas Wolff [this message]

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=4a29b2b9-cf36-7613-fdcc-c9b854de75fe@towo.net \
    --to=towo@towo.net \
    --cc=cygwin-developers@cygwin.com \
    --cc=takashi.yano@nifty.ne.jp \
    /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).