From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 98777 invoked by alias); 12 Apr 2019 10:22:49 -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 98764 invoked by uid 89); 12 Apr 2019 10:22:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-7.6 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=java, H*F:D*ne.jp, Procedures, menu X-HELO: conuserg-03.nifty.com Received: from conuserg-03.nifty.com (HELO conuserg-03.nifty.com) (210.131.2.70) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Apr 2019 10:22:46 +0000 Received: from localhost.localdomain (ntsitm424054.sitm.nt.ngn.ppp.infoweb.ne.jp [219.97.74.54]) (authenticated) by conuserg-03.nifty.com with ESMTP id x3CAMPdF014767; Fri, 12 Apr 2019 19:22:33 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-03.nifty.com x3CAMPdF014767 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp; s=dec2015msa; t=1555064553; bh=Gn+EklQ3OsESSOjJIOInxilFpq4H/0OQwnk1GUaPRvY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D7xYQiUVDW2V9hUitvFCDW2h/W1YK5rNoo5lzphTBYMuWrFXjCOcRw9FqE5CeAD5D Y/deb1bHdLTCxn1CZ0Flt9KgoDYeKojjqagSvXWTre2TKafttPjip1qn3UHxPwVska Lk5ae+BVas6sAmeyt5Mmhf6GbmIqLh2trUYfa7gIqLiZfCj5nAwo6c2JL2n7Wyj3B3 7yXOzUz0hUudJ7Z8fHysS+EcTgDU7fJgA+vdJHP9S3rlZL40N9eEHEsw5eAE6M4CzM ogsOPa5yShd9gTM8iH3fu9Qt5heTO7aRuof7XYBXfWgMo9zsPCWjZxFaqCXcHoH5VI Z3A+KADpnC/ZA== From: Takashi Yano To: cygwin-developers@cygwin.com Cc: Takashi Yano Subject: [PATCH v4 0/1] Pseudo console support in PTY (v4) Date: Fri, 12 Apr 2019 10:22:00 -0000 Message-Id: <20190412102047.669-1-takashi.yano@nifty.ne.jp> In-Reply-To: <4b4aae13-877c-8521-54c5-dcf2dafbc66d@towo.net> <20190406174335.GC4248@calimero.vinschen.de> References: <4b4aae13-877c-8521-54c5-dcf2dafbc66d@towo.net> <20190406174335.GC4248@calimero.vinschen.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2019-04/txt/msg00033.txt.bz2 Hi Thomas and Corinna, I revised the patch to v4. Major chages from v3: (1) Refine the algorithm for switching I/O between cygwin apps and native console apps. This resolves the following issues. - Output from native console app cannot be displayed if the app is executed in the background. This is because the I/O is switched to cygwin shell. - When a native console app is foreground, it lose input if you execute: echo something > /dev/pty* from another terminal. - The native console app, which just read input without any output, fails. (2) Add error handlings when attaching to pseudo console fails. (3) The timing of terminating cygwin-console-helper is changed. Previously, it was when the pty master opened first was closed. Now, it is when the last pty master is closed. (4) Clear-screen for "synchronization" is limited only to the first attach of pty slave. (5) Procedures after attaching to pseudo console are moved into the function: fixup_after_attach(). (6) Avoid that the code page is set to 65001 even when the locale is not *.UTF-8. This fixes the issue that shell freezes when non ascii chars are typed. (7) As a test, call init_console_handler() at attaching to pseudo console according to Corinna's suggestion. On Sat, 6 Apr 2019 23:33:04 +0200 Thomas Wolff wrote: > If I try a non-Unicode terminal session, e.g. running mintty -o Locale=C > -o Charset=CP1252 -, and enter a € key, mintty hangs. While you said it > doesn't work (yet), it should better not hang at least. This is resolved by (6). On Sat, 6 Apr 2019 23:33:04 +0200 Thomas Wolff wrote: > 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). Again, I don't > see a need that you intercept this at all. This is resolved by (1). 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. Thanks for the test case. This can be reproduced, but the behaviour is exactly the same as that in the command prompt, in the both cases (a) and (b) below. So I think it is not the problem of implementation of pty. (a) chcp 65001 java -Dfile.encoding=UTF-8 YourProg (b) chcp 1252 java -Dfile.encoding=CP1252 YourProg Regarding (7), On Sat, 6 Apr 2019 19:43:35 +0200 Corinna Vinschen wrote: > This looks better, but there's still some problem: > $ cygport gawk.cygport build > >>> Compiling gawk-4.2.62-1.x86_64 > [pressing Ctrl-C multiple times] > 14 [main] chmod (7016) child_copy: cygheap read copy failed, 0x180376408..0 > x1803887A8, done 0, windows pid 7016, Win32 error 299 > 766 [main] chmod (7016) C:\cygwin64\bin\chmod.exe: *** fatal error - ccalloc would have returned NULL > 14 [main] chmod (7016) child_copy: cygheap read copy failed, 0x180376408..0x1803887A8, done 0, windows pid 7016, Win32 error 299 > 766 [main] chmod (7016) C:\cygwin64\bin\chmod.exe: *** fatal error - ccalloc > would have returned NULL I cannot reproduce this, but I added init_console_handler() call after attaching to pseudo console for a test according to your suggestion. Could you please test? D=http://tyan0.dip.jp/cygwin ${D}/x86_64/test/cygwin1-20190412.dll.xz ${D}/x86_64/test/cygwin-console-helper.exe.xz ${D}/x86/test/cygwin1-20190412.dll.xz ${D}/x86/test/cygwin-console-helper.exe.xz Takashi Yano (1): Cygwin: pty: add pseudo console support. winsup/cygwin/dtable.cc | 57 +++ winsup/cygwin/fhandler.h | 42 +- winsup/cygwin/fhandler_console.cc | 32 ++ winsup/cygwin/fhandler_tty.cc | 671 ++++++++++++++++++++++++-- winsup/cygwin/fork.cc | 24 + winsup/cygwin/select.cc | 22 +- winsup/cygwin/spawn.cc | 55 +++ winsup/cygwin/tty.cc | 7 + winsup/cygwin/tty.h | 23 +- winsup/utils/cygwin-console-helper.cc | 14 +- 10 files changed, 903 insertions(+), 44 deletions(-) -- 2.17.0