X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-7.5 required=5.0 tests=AWL,BAYES_00,KHOP_PGP_SIGNED,KHOP_THREADED,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Message-ID: <505764B9.9010406@dancol.org> Date: Mon, 17 Sep 2012 10:58:17 -0700 From: Daniel Colascione User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:15.0) Gecko/20120824 Thunderbird/15.0 MIME-Version: 1.0 To: cygwin AT cygwin DOT com Subject: Re: Win PTY library. References: <20120915162136 DOT GB25529 AT ednor DOT casa DOT cgf DOT cx> <5057036D DOT 3080304 AT dancol DOT org> <5057254C DOT 4040405 AT cwilson DOT fastmail DOT fm> <20120917134855 DOT GC16552 AT ednor DOT casa DOT cgf DOT cx> In-Reply-To: <20120917134855.GC16552@ednor.casa.cgf.cx> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig52C34C558BB7713CA47E9C23" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com --------------enig52C34C558BB7713CA47E9C23 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On 9/17/12 6:48 AM, Christopher Faylor wrote: > On Mon, Sep 17, 2012 at 03:42:14PM +0200, V??clav Zeman wrote: >> On 17 September 2012 15:27, Charles Wilson wrote: >>> Well, that's exactly what Console2 does, and it works pretty well. >>> I've never seen any "missing" data when using it. I don't know what >>> they're doing to work around the deadlock issue, but whatever it is it >>> works. As I can tell from reading the code, Console2 is still just polling and scraping. The specific deadlock I mentioned doesn't matter if you don't use the console accessibility APIs, which don't appear particularly useful in any case. >> I think that the difference is that PTY is a stream of commands that >> get interpreted, OTOH, polled Windows console can provide only a >> snapshot at some point in time. It seems that it would be hard to >> produce faithful stream of commands from this console snapshot. >> Because Console2 is only visualizing the snapshot in its own GUI >> window, it does not matter that it is doing that by snapshotting the >> hidden console. But for the PTY abstraction, a faithful chain of >> commands seems necessary. I think that any such polling based >> implementation could miss some transitions in the PTY state in between >> the polls. >=20 > I don't see why this matters more for a pty than for Console2. I expect expect(1) to work for a general-purpose pty. Building into Cygwin a pty layer that's based on lossy scraping of Windows consoles is a bad idea. I expect more from the pty layer than from a tool (like Console2) designed exclusively for human consumers. If Cygwin adopts such a thing, I'll disable it in configuration. If I can't do that, I'll hack it out of the code, and if I can't do that, I'll use the last Cygwin snapshot without the change until its host operating system falls out of support. If you really want to emulate consoles, the right thing to do is to hook the console APIs globally. That way, console operations are synchronous, fast, and correct, and any program into which the hook can't be injected could just fall back to today's pipe-based approach. > But, rather than theorize that this doesn't work why not just point to > code to prove it? These kind of discussions don't have to be opinions > thanks to the wonders of open source. If your pty layer refreshes every 100ms and your program updates at 20, 40, and 80ms, you'll lose all but the last update. I'm not interested in writing a testcase to demonstrate a perfectly foreseeable problem. --------------enig52C34C558BB7713CA47E9C23 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (Darwin) Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAlBXZLoACgkQ17c2LVA10Vu70gCgn61gNK9ALT1Th3NK6VZFjQ37 BfwAoIlJbbNa3AykLGcV6nlUmbEkOwrS =Rl33 -----END PGP SIGNATURE----- --------------enig52C34C558BB7713CA47E9C23--