Re: Win PTY library.
On Mon, Sep 24, 2012 at 9:09 AM, Earnie Boyd wrote: On Sat, Sep 22, 2012 at 7:46 PM, Linda Walsh wrote: Sorry for the slip on removing the email address. Won't even think about 100ms / result. tried... now my head hurts. However, if I start the windows ftp program if the ideas behind Console2 and the winPTY library work I would now be able to see the output in proper order in a Cygwin enabled terminal such as mintty. This sentence should read: However,if I start the windows ftp program and if the ideas behind Console2 and the winPTY library work for Cygwin I would not be able to see the output in proper order in a Cygwin enabled terminal such as mintty. -- Earnie -- https://sites.google.com/site/earnieboyd -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Win PTY library.
Václav Zeman wrote: 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. I'd have to agree with Václav. If you are using the pty interactively, it won't be problem, BUT programs use pty's to drive other programs, programatically, and rely on pipe type speeds to be able to communicate to them. Imagine rsync, which goes over pipes -- if it sprayed through data at full speeds, that only got picked up every 100ms -- i'd imagine alot more than a screen full of data would go by in the transfer. I am working on a program right now that starts a inspection tool then issues commands to it -- I want to be able to query about 100-200K files... if those take even a full ms. each, I'm looking at over 3 minutes. If polling resulted in me getting back results every 10ms, it'd be over a half an hour...way not good. Won't even think about 100ms / result. tried... now my head hurts. -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Win PTY library.
On 9/15/2012 9:21 AM, Christopher Faylor wrote: On Sat, Sep 15, 2012 at 12:15:49PM -0400, Earnie Boyd wrote: I just discovered https://github.com/rprichard/winpty and thought Cygwin users and developers may be interested. The license is MIT style. Looks interesting. I've had something similar sitting around in my Cygwin sandbox for a while. It would be nice to have a real console-based pty implementation. Unfortunately, this program works by polling and scraping a hidden console window. Any approach of this type will lose data. (No, you can't synchronize your scraping by using console accessibility APIs because conhost calls out into accessibility with its locks held, and if you try to read the console buffer in this context, you deadlock.) The best userspace solution would be chained DLL injection, but this approach has its own problems --- the console handle can get decoupled from the DLL injection in a number of ways. The most robust approach would be an NT filter driver attached to the console driver itself. That'd only work on systems with a non-insane console layer (i.e., post-Vista systems), and you'd have to figure out the internal console communication protocol. signature.asc Description: OpenPGP digital signature
Re: Win PTY library.
On 9/17/2012 7:03 AM, Daniel Colascione wrote: On 9/15/2012 9:21 AM, Christopher Faylor wrote: On Sat, Sep 15, 2012 at 12:15:49PM -0400, Earnie Boyd wrote: I just discovered https://github.com/rprichard/winpty and thought Cygwin users and developers may be interested. The license is MIT style. Looks interesting. I've had something similar sitting around in my Cygwin sandbox for a while. It would be nice to have a real console-based pty implementation. Unfortunately, this program works by polling and scraping a hidden console window. Any approach of this type will lose data. (No, you can't synchronize your scraping by using console accessibility APIs because conhost calls out into accessibility with its locks held, and if you try to read the console buffer in this context, you deadlock.) 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. -- Chuck -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Win PTY library.
On 17 September 2012 15:27, Charles Wilson wrote: On 9/17/2012 7:03 AM, Daniel Colascione wrote: On 9/15/2012 9:21 AM, Christopher Faylor wrote: On Sat, Sep 15, 2012 at 12:15:49PM -0400, Earnie Boyd wrote: I just discovered https://github.com/rprichard/winpty and thought Cygwin users and developers may be interested. The license is MIT style. Looks interesting. I've had something similar sitting around in my Cygwin sandbox for a while. It would be nice to have a real console-based pty implementation. Unfortunately, this program works by polling and scraping a hidden console window. Any approach of this type will lose data. (No, you can't synchronize your scraping by using console accessibility APIs because conhost calls out into accessibility with its locks held, and if you try to read the console buffer in this context, you deadlock.) 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. 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. -- VZ -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Win PTY library.
On Mon, Sep 17, 2012 at 09:27:40AM -0400, Charles Wilson wrote: On 9/17/2012 7:03 AM, Daniel Colascione wrote: On 9/15/2012 9:21 AM, Christopher Faylor wrote: On Sat, Sep 15, 2012 at 12:15:49PM -0400, Earnie Boyd wrote: I just discovered https://github.com/rprichard/winpty and thought Cygwin users and developers may be interested. The license is MIT style. Looks interesting. I've had something similar sitting around in my Cygwin sandbox for a while. It would be nice to have a real console-based pty implementation. Unfortunately, this program works by polling and scraping a hidden console window. Any approach of this type will lose data. (No, you can't synchronize your scraping by using console accessibility APIs because conhost calls out into accessibility with its locks held, and if you try to read the console buffer in this context, you deadlock.) 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. Ditto. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Win PTY library.
On Mon, Sep 17, 2012 at 03:42:14PM +0200, V??clav Zeman wrote: On 17 September 2012 15:27, Charles Wilson wrote: On 9/17/2012 7:03 AM, Daniel Colascione wrote: On 9/15/2012 9:21 AM, Christopher Faylor wrote: On Sat, Sep 15, 2012 at 12:15:49PM -0400, Earnie Boyd wrote: I just discovered https://github.com/rprichard/winpty and thought Cygwin users and developers may be interested. The license is MIT style. Looks interesting. I've had something similar sitting around in my Cygwin sandbox for a while. It would be nice to have a real console-based pty implementation. Unfortunately, this program works by polling and scraping a hidden console window. Any approach of this type will lose data. (No, you can't synchronize your scraping by using console accessibility APIs because conhost calls out into accessibility with its locks held, and if you try to read the console buffer in this context, you deadlock.) 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. 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. I don't see why this matters more for a pty than for Console2. 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. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Win PTY library.
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. 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. signature.asc Description: OpenPGP digital signature
Re: Win PTY library.
On Mon, Sep 17, 2012 at 1:58 PM, Daniel Colascione wrote: 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. So create a patch that works based on your ideas of how it should work. So far, there have not been any who have been able to do it for the case of Cygwin execing a native MSVCRT binary. If the ideas behind Console2 and winpty can do so, great, it is a step in the right direction. If you can come up with a working model other than what these are doing then prove it. -- Earnie -- https://sites.google.com/site/earnieboyd -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Win PTY library.
I just discovered https://github.com/rprichard/winpty and thought Cygwin users and developers may be interested. The license is MIT style. -- Earnie -- https://sites.google.com/site/earnieboyd -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Re: Win PTY library.
On Sat, Sep 15, 2012 at 12:15:49PM -0400, Earnie Boyd wrote: I just discovered https://github.com/rprichard/winpty and thought Cygwin users and developers may be interested. The license is MIT style. Looks interesting. I've had something similar sitting around in my Cygwin sandbox for a while. It would be nice to have a real console-based pty implementation. cgf -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple