DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 5ATCXjQj1180486 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 5ATCXjQj1180486 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=bxqAT9ye X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1E58048FD873 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1764419624; bh=xesi2qfvYkT7sRXBgsU8ee18o01FtqqLYLnckBh/jUo=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=bxqAT9yezJ3lpvxS21/jCYVs5QNVLQmuKd0DVBRDXOaSE9dOvouZG4ahiGRcgyDjA /aXGIxEbWMuf5uNeexDfkvjzOY8Yz/bxk4Dg7SCnb5FAo3dBINWt6DzbTKrNvCw64Q u1VdQXdX5UrQSRhTBhjpR6A2E49tEbg7YRluwaJE= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62F3148FB424 ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 62F3148FB424 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764419603; cv=none; b=wmc0V27tN5RiyyY8d6SEoEaTg6RKV7K5U28vLqCQjSlFlUfUmcA3nFd2G45jRE1hAAHsqqV+PHGbMA2nl2JM+vJ5sAqXEHRLGIjTVWvFHuOHYxOY0cUnZ2k2EtoHmYrlmrTkofhfAJ1DYJCNDDNh6hd4E2Mn1G0S1uiRYQDe67c= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1764419603; c=relaxed/simple; bh=EIhdtIwD0sMJNMtAjmptzSyV7OYyXIzB44va7dnk11g=; h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; b=uE4iwbIGaCQFWDPj6PIiPQMTvDik5u8cISgdlrBm2d7awFQ8ObtL46w2d+r2B3g5WwqA9tRUp/gyNniK57reiltYXqngrlmJMTWO0qj322jSUwdJwKBNOXbpbSC5quTwLuUirfOQ72O9xvMTFh50/U56ZlylB6r5BFw07Txw9bY= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62F3148FB424 Date: Sat, 29 Nov 2025 21:33:20 +0900 To: cygwin AT cygwin DOT com Subject: Re: dynamic conpty loading Message-Id: <20251129213320.85712313bb08cbb047a89861@nifty.ne.jp> In-Reply-To: References: <30deef29-ba20-49d9-9b38-28020941b0ef AT towo DOT net> <707f4d4c-a20d-4f1d-bdbd-65a2392dea15 AT towo DOT net> <20251121190433 DOT 4a37dc959848a0aea89a8922 AT nifty DOT ne DOT jp> <62f3c1ae-1fd9-477d-a837-d865094dab06 AT towo DOT net> <20251126193220 DOT 1b890f58a121add2f0d05fa5 AT nifty DOT ne DOT jp> <3a6ed5bc-24fd-42b0-9f57-83c8eb678a1b AT towo DOT net> <20251127172026 DOT 6b6f876fd341f9c0cbd1f876 AT nifty DOT ne DOT jp> <20251127230436 DOT 92c7d7945dd145a8e40a4d87 AT nifty DOT ne DOT jp> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 5ATCXjQj1180486 Hi Thomas, On Thu, 27 Nov 2025 17:52:33 +0100 Thomas Wolff wrote: > Am 27.11.2025 um 15:04 schrieb Takashi Yano via Cygwin: > > On Thu, 27 Nov 2025 17:20:26 +0900 > > Takashi Yano wrote: > >> On Wed, 26 Nov 2025 19:50:07 +0100 > >> Thomas Wolff wrote: > >>> Am 26.11.2025 um 11:32 schrieb Takashi Yano via Cygwin: > >>>> On Fri, 21 Nov 2025 17:58:01 +0100 > >>>> Thomas Wolff wrote: > >>>> > >>>>> Am 21.11.2025 um 17:46 schrieb Corinna Vinschen via Cygwin: > >>>>>> Hi Thomas, > >>>>>> > >>>>>> On Nov 21 16:46, Thomas Wolff via Cygwin wrote: > >>>>>>> Am 21.11.2025 um 11:04 schrieb Takashi Yano via Cygwin: > >>>>>>>> On Sun, 5 Oct 2025 10:15:55 +0200 > >>>>>>>> Thomas Wolff wrote: > >>>>>>>>>>> The procedure seems to be: > >>>>>>>>>>> try LoadLibrary("conpty.dll"), (if not successful, fallback to > >>>>>>>>>>> GetModuleHandle("kernel32") instead) to retrieve GetProcAddress for > >>>>>>>>>>> CreatePseudoConsole, ResizePseudoConsole, ClosePseudoConsole, and > >>>>>>>>>>> then somehow (?) use those while calling CreateProcess. > >>>>>>>>>>> The latter is woven into the cygwin library and I don't think it's a > >>>>>>>>>>> good idea to clone that out of cygwin for a patched process creation > >>>>>>>>>>> in mintty. > >>>>>>>>>>> > >>>>>>>>>>> My question/suggestion: > >>>>>>>>>>> Can a cygwin mode switch to a selected conpty library instead of the > >>>>>>>>>>> default one please? > >>>>>> Where do you expect this conpty.dll to reside? > >>>>>> > >>>>>> If we do something like that, I would suggest to make sure that this > >>>>>> conpty.dll is in a well-defined place. /bin or /lib might be a good > >>>>>> idea. And if it exists in this defined place, it will be used by Cygwin. > >>>>>> > >>>>>> We can tweak the autoload mechanism to allow a primary DLL and a fallback > >>>>>> DLL, that drops the need to set the CYWIN env var. > >>>>>> > >>>>>> The mintty package could contain a post-install script, or some other > >>>>>> script in /bin to allow a user with admin rights downloading the latest > >>>>>> (or the most sensible) conpty.dll from MSFT. > >>>>>> > >>>>>> Would that make sense? > >>>>>> > >>>>>> > >>>>>> Corinna > >>>>>> > >>>>> That makes much sense, yes, thank you. /bin/conpty.dll would probably be > >>>>> a good place. > >>>> I checked the source of conpty.dll > >>>> https://github.com/microsoft/terminal/blob/main/src/winconpty/winconpty.cpp > >>>> > >>>> conpty.dll seems to launch OpenConsole.exe in the directory where > >>>> WindowsTerminal is installed. > >>>> However, BUILTIN\Users does not have permission to execute OpenConsole.exe. > >>>> > >>>> Do you have some idea how to solve this problem? > >>>> WindowsTerminal itself can launch OpenConsole.exe, so there should be > >>>> some solutions, I think. > >>> Did you install the nuget package? It can be extracted with zip, so you > >>> can install OpenConsole as a normal program... > >>> I did not find a way, though, to invoke it explicitly so that it would > >>> solve the pty interworking problems. > >> Thanks. > >> > >> I've made an experimental patch against fhandler/pty.cc and > >> draft package named openconsole that installs official OpenConsole.exe > >> binary into /usr/bin. > >> > >> I confirmed the patch with openconsole package enables the mouse > >> support for vim91 and neovim 0.8.0 (native windows binary) in > >> pseudo console. > >> > >> Any comments and suggestions would be appreciated. > > openconsole-1.23.12811.0-1.cygwin.patch fixed. > Thanks, I've tried to build latest newlib-cygwin with the 0001-... patch > but then I'm getting this: > >       0 [main] bash 27975 child_copy: dll data read copy failed, > 0x7FFA4C7CE000..0x7FFA4C7E7C90, done 0, windows pid 22444, Win32 error 299 >                                                                  0 > [main] -bash 27950 dofork: child -1 - forked process 22444 died > unexpectedly, retry 0, exit code 0xC0000005, errno 11 >                         -bash: fork: retry: Resource temporarily > unavailable Thanks for testing. When do you get the error above? In my environment, the patch works under Win11/Win10 with and without OpenConsole.exe installed. Win32 error 299 is ERROR_PARTIAL_COPY, so child_copy copied only partially some reason. However, I don't change any code path for native cygwin program with this patch. Therefore, I believe the patch does not affect fork(). -- Takashi Yano -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple