From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 84475 invoked by alias); 7 Apr 2019 21:21:12 -0000 Mailing-List: contact cygwin-developers-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com Received: (qmail 84465 invoked by uid 89); 7 Apr 2019 21:21:12 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,UNSUBSCRIBE_BODY autolearn=no version=3.3.1 spammy=observed, Java, adapter, bh X-HELO: mout.kundenserver.de Received: from mout.kundenserver.de (HELO mout.kundenserver.de) (212.227.126.130) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 07 Apr 2019 21:21:09 +0000 Received: from [192.168.178.45] ([95.91.242.222]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MWAf4-1hNbM50bOM-00XYq2; Sun, 07 Apr 2019 23:21:03 +0200 Subject: Re: [PATCH v3 0/1] Pseudo console support in PTY (v3) To: cygwin-developers@cygwin.com, Takashi Yano References: <20190404104606.GA24725@calimero.vinschen.de> <20190406111308.1822-1-takashi.yano@nifty.ne.jp> <4b4aae13-877c-8521-54c5-dcf2dafbc66d@towo.net> <20190407140535.83d70ba0ac7f249a87d18dd2@nifty.ne.jp> From: Thomas Wolff Message-ID: <4a29b2b9-cf36-7613-fdcc-c9b854de75fe@towo.net> Date: Sun, 07 Apr 2019 21:21:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190407140535.83d70ba0ac7f249a87d18dd2@nifty.ne.jp> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00027.txt.bz2 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));   } }