From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-06.nifty.com (conssluserg-06.nifty.com [210.131.2.91]) by sourceware.org (Postfix) with ESMTPS id B42D03860C37 for ; Thu, 23 Jul 2020 17:18:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B42D03860C37 Received: from Express5800-S70 (v038192.dynamic.ppp.asahi-net.or.jp [124.155.38.192]) (authenticated) by conssluserg-06.nifty.com with ESMTP id 06NHHevG022393 for ; Fri, 24 Jul 2020 02:17:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com 06NHHevG022393 X-Nifty-SrcIP: [124.155.38.192] Date: Fri, 24 Jul 2020 02:17:40 +0900 From: Takashi Yano To: cygwin-developers@cygwin.com Subject: Re: New implementation of pseudo console support (experimental) Message-Id: <20200724021740.8cca18532c7873f1f6c34570@nifty.ne.jp> In-Reply-To: <9f7a8e29-5a65-eead-e3d9-a5d135ea21c6@towo.net> References: <20200513211609.011d188c3a735b00d55591df@nifty.ne.jp> <20200514182859.c5236a8889ab3081d2e8c937@nifty.ne.jp> <20200514183420.c246647a6d9e396d42c6b47e@nifty.ne.jp> <20200516092956.74369d694d611b1dcd095607@nifty.ne.jp> <20200516164735.2a2ef183788b151e9185ef41@nifty.ne.jp> <20200519224018.746f6324badd8a5762df42b1@nifty.ne.jp> <20200525195332.cf60ab2f38d167a76513740e@nifty.ne.jp> <20200526100955.30b1a2baea517e0565f30db6@nifty.ne.jp> <20200529004024.0c2ac3c68b588bda987e0837@nifty.ne.jp> <20200701204751.27609a8f5701010468521a87@nifty.ne.jp> <20200717111912.GG3784@calimero.vinschen.de> <5a952942-239a-997c-9e5c-5ce8cfd0bfb0@towo.net> <20200718140510.707b46c536ae2b80f51e77f8@nifty.ne.jp> <9f7a8e29-5a65-eead-e3d9-a5d135ea21c6@towo.net> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Multipart=_Fri__24_Jul_2020_02_17_40_+0900_O8m04gd5GWnZdyse" X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jul 2020 17:18:07 -0000 This is a multi-part message in MIME format. --Multipart=_Fri__24_Jul_2020_02_17_40_+0900_O8m04gd5GWnZdyse Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hi Thomas, On Sat, 18 Jul 2020 22:57:24 +0200 Thomas Wolff wrote: > Am 18.07.2020 um 07:05 schrieb Takashi Yano via Cygwin-developers: > > Hi Thomas, > > > > Thanks for testing. > > > > On Fri, 17 Jul 2020 16:59:56 +0200 > > Thomas Wolff wrote: > >> Am 17.07.2020 um 14:47 schrieb Thomas Wolff: > >>> Am 17.07.2020 um 13:19 schrieb Corinna Vinschen: > >>>> Hi Takashi, > >>>> > >>>> On Jul  1 20:47, Takashi Yano via Cygwin-developers wrote: > >>>>> On Fri, 29 May 2020 00:40:24 +0900 > >>>>> Takashi Yano via Cygwin-developers > >>>>> wrote: > >>>>>> On Tue, 26 May 2020 10:09:55 +0900 > >>>>>> Takashi Yano via Cygwin-developers > >>>>>> wrote: > >>>>>>> On Mon, 25 May 2020 19:53:32 +0900 > >>>>>>> Takashi Yano via Cygwin-developers > >>>>>>> wrote: > >>>>>>>> On Tue, 19 May 2020 22:40:18 +0900 > >>>>>>>> Takashi Yano via Cygwin-developers > >>>>>>>> wrote: > >>>>>>>>> On Sat, 16 May 2020 16:47:35 +0900 > >>>>>>>>> Takashi Yano via Cygwin-developers > >>>>>>>>> wrote: > >>>>>>>>>> On Sat, 16 May 2020 09:29:56 +0900 > >>>>>>>>>> Takashi Yano via Cygwin-developers > >>>>>>>>>> wrote: > >>>>>>>>>>> Fix a small bug caused when stdio is redirected to another pty. > >>>>>>>>>> Fix another bug caused when stdio is redirected to another pty. > >>>>>>>>> Revise the patch to fit the current git head. > >>>>>>>> Revise the patch again to fit the current git head. > >>>>>>> Make app, which reads stdin, work under gdb. > >>>>>> * Prevent ResizePseudoConsole() calls unless the pty is resized. > >>>>>> * Revise the patch to fit the current git head. > >>>>> Revise the patch to fit the current git head. > >>>> are you satisfied with the code?  If you want to merge it, > >>>> I'd bump Cygwin to 3.2. > >>> (blush) I apologize, I had promised to run my test cases. > >>> Beginning with it, the first succeeded, the second failed: > >>> run notepad (from mintty), click back into terminal, enter ^Z > >>> It says "Stopped" but the process is gone. > >>> > >>> Continuing may test suite soon... > >> OK, so here are finally my updated test results: > >> > >> > >> resize terminal while running Windows cmd > >> run cmd, resize, run dir/P: > >> ✓works > >> > >> > >> terminal reports in response to request escape sequences > >> ("\033[6n", "\033[0c", "\033[>c", '\033[18t', '\033]10;?\033\') > >> ✓works > >> > >> > >> output to alternate screen > >> echo -e "\e[?1047h"; cmd > >> ✓works > >> cmd > >> from other terminal: echo -e "\e[?1047h" > /dev/pty... > >> ↯no output; weird behaviour on ^C, mintty terminating (also in 3.1.6) > > I found this is a bug introduced in commit > > 0365031ce1347600d854a23f30f1355745a1765c. > > > > I will submit a patch for this issue. > > > >> signal handling/mediation; catch SIGTSTP > >> run notepad, click back into terminal, enter ^Z > >> ↯fails, notepad is terminated > >> -> this is a regression, ^Z,^C,^\ used to be ignored > > This behaviour is the same as cygwin 3.0.7. Pseudo console is not > > activated for native GUI processes. > OK, I understand this is consistent with my own proposal to apply pseudo > console only for Windows command-line programs. On the other hand, fatal > signal handling is another nuisance of running Windows programs from > cygwin, so there was a benefit. > Is it possible to activate the signal interworking without setting up a > pseudo console? If not, is it maybe worth to set it up also for Windows > GUI programs just for this purpose? (Modifying my proposal to trigger on > any Windows program.) When pseudo console is activated for GUI apps, ^C, ^Z and ^\ are just ignored. Please try additional patch attached with the latest pseudo console patch. Is this as you expected? I'm not sure which behaviour is better. Does anyone have opinion? -- Takashi Yano --Multipart=_Fri__24_Jul_2020_02_17_40_+0900_O8m04gd5GWnZdyse Content-Type: text/plain; name="pcon-activate-for-gui-apps.diff" Content-Disposition: attachment; filename="pcon-activate-for-gui-apps.diff" Content-Transfer-Encoding: 7bit diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index a3071884e..4524423b3 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -194,24 +194,6 @@ handle (int fd, bool writing) return h; } -static bool -is_console_app (WCHAR *filename) -{ - HANDLE h; - const int id_offset = 92; - h = CreateFileW (filename, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, 0, NULL); - char buf[1024]; - DWORD n; - ReadFile (h, buf, sizeof (buf), &n, 0); - CloseHandle (h); - char *p = (char *) memmem (buf, n, "PE\0\0", 4); - if (p && p + id_offset <= buf + n) - return p[id_offset] == '\003'; /* 02: GUI, 03: console */ - else - return false; -} - int iscmd (const char *argv0, const char *what) { @@ -632,7 +614,7 @@ child_info_spawn::worker (const char *prog_arg, const char *const *argv, STARTUPINFOEXW si_pcon; ZeroMemory (&si_pcon, sizeof (si_pcon)); STARTUPINFOW *si_tmp = &si; - if (!iscygwin () && ptys_primary && is_console_app (runpath)) + if (!iscygwin () && ptys_primary) if (ptys_primary->setup_pseudoconsole (&si_pcon)) { c_flags |= EXTENDED_STARTUPINFO_PRESENT; --Multipart=_Fri__24_Jul_2020_02_17_40_+0900_O8m04gd5GWnZdyse--