From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from conssluserg-01.nifty.com (conssluserg-01.nifty.com [210.131.2.80]) by sourceware.org (Postfix) with ESMTPS id D96113858D35 for ; Mon, 3 Aug 2020 02:05:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D96113858D35 Received: from Express5800-S70 (v038192.dynamic.ppp.asahi-net.or.jp [124.155.38.192]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 07324tXX029471 for ; Mon, 3 Aug 2020 11:04:55 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 07324tXX029471 X-Nifty-SrcIP: [124.155.38.192] Date: Mon, 3 Aug 2020 11:05:04 +0900 From: Takashi Yano To: cygwin-developers@cygwin.com Subject: Re: New implementation of pseudo console support (experimental) Message-Id: <20200803110504.9484b7486f8f450efc7a732a@nifty.ne.jp> In-Reply-To: <20200802120104.GD460314@calimero.vinschen.de> References: <20200529004024.0c2ac3c68b588bda987e0837@nifty.ne.jp> <20200701204751.27609a8f5701010468521a87@nifty.ne.jp> <20200717111912.GG3784@calimero.vinschen.de> <20200718143024.45920213c7aa81912939d944@nifty.ne.jp> <20200720080613.GE16360@calimero.vinschen.de> <20200722031751.e02bf24a7519b43d80e5db71@nifty.ne.jp> <20200722174541.c8113635236fd217cb9ebb77@nifty.ne.jp> <20200723093328.709654ea6a539cb9b3251ab2@nifty.ne.jp> <20200724143842.020cea9ffa2f6e7ffe760f67@nifty.ne.jp> <20200724202219.16ad238f515da19db21d3a6c@nifty.ne.jp> <20200802120104.GD460314@calimero.vinschen.de> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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: Mon, 03 Aug 2020 02:05:18 -0000 Hi Corinna, On Sun, 2 Aug 2020 14:01:04 +0200 Corinna Vinschen wrote: > On Jul 24 20:22, Takashi Yano via Cygwin-developers wrote: > > On Fri, 24 Jul 2020 14:38:42 +0900 > > Takashi Yano via Cygwin-developers wrote: > > > On Thu, 23 Jul 2020 09:33:28 +0900 > > > Takashi Yano via Cygwin-developers wrote: > > > > On Wed, 22 Jul 2020 17:45:41 +0900 > > > > Takashi Yano via Cygwin-developers wrote: > > > > > > [...] > > > > > Attached is the patch in git format-patch format. > > > > > All the codes specific to the current implementation are removed. > > > > > > > > > > Despite the utmost care, the changes are relatively large, so some > > > > > degradation may exist. > > > > > > > > > > I will appreciate if you could test. > > > > > > > > There were still unused code. Please try attached patch instead. > > > > > > Changes: > > > * Do not activate pseudo console if it is already activated for > > > another process on same pty. > > > > Changes: > > * Fix a bug in the latest change. > > > > -- > > Takashi Yano > > While hacking on the posix_spawn thingy, I noticed this hunk of yours: > > @@ -897,6 +910,11 @@ child_info_spawn::worker (const char *prog_arg, const char > *const *argv, > && WaitForSingleObject (pi.hProcess, 0) == WAIT_TIMEOUT) > wait_for_myself (); > } > + if (enable_pcon) > + { > + WaitForSingleObject (pi.hProcess, INFINITE); > + ptys_primary->close_pseudoconsole (); > + } > myself.exit (EXITCODE_NOSET); > break; > case _P_WAIT: > > Wait... what? So the exec'ing process hangs infinitely if the exec'ed > process runs infinitely? Doesn't that have weird side effects by any > chance? This is needed to close pseudo console when the native console app is terminated. exec() call does not return on success. So the caller is not affected. If mode == _P_OVERLAY, the process is not seen from cygwin, though, it is seen from windows task manager. I have not noticed any serious side effects so far. BTW, I have noticed the current code cause handle leak if mode != _P_OVERLAY due to lack of chance to close pseudo console. I will submit a new patch. -- Takashi Yano