Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin AT sources DOT redhat DOT com Date: Sat, 2 Dec 2000 20:08:32 -0500 From: Christopher Faylor To: cygwin Subject: Re: Why does scp leave ssh running? -- select() never returns Message-ID: <20001202200832.A18661@redhat.com> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin References: <3A22C383 DOT 5C16BBC8 AT delcomsys DOT com> <3A25C7DA DOT 6F76C8DA AT delcomsys DOT com> <20001129224015 DOT B21867 AT redhat DOT com> <3A266130 DOT F5877EB5 AT delcomsys DOT com> <3A271DCD DOT 99BDDBF5 AT delcomsys DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.11i In-Reply-To: <3A271DCD.99BDDBF5@delcomsys.com>; from wpd@delcomsys.com on Thu, Nov 30, 2000 at 10:41:01PM -0500 Sorry for the delay in responding. On Thu, Nov 30, 2000 at 10:41:01PM -0500, Patrick Doyle wrote: >> If that is the case, would anybody mind if I posted a (simple) patch to >> openSSH code which added a timeout to the call(s) to select()? >> >> (Note, I haven't tried this patch yet -- I just thought of it ... > >Status update... > >Adding the timeout to the call to select() did not solve the problem >(which is consistent with Christopher's assertion that "The only way to >trigger the EOF is to actually read from the pipe". Actually, I wasn't >too keen about solving the problem by hacking openSSH; it would just >mean that the problem had to be solved again and again for other >packages. > >So now what? Does anybody have any suggestions for other things that I >could try? I would prefer to solve this problem in cygwin1.dll, but I >am, by no means, an expert windows programmer, so right now, I find >myself just flailing. > >The two ideas I have so far are: >1) Switch from using anonymous pipes to using named pipes with unique >names. According to the documentation on the MSDN web site, this is how >anonymous pipes are implemented in W2K and NT. Maybe this will solve >the problem, maybe it won't. Maybe it will allow me to call a function >which will let me know if the other end has closed the pipe. (Most of >the functions I have found on the MSDN web site are specific to named >pipes). Maybe it won't. You can't create named pipes on Windows 95, unfortunately. >2) Change the thread_pipe to call ReadFile() (reading one byte) instead >of PeekNamedPipe() and save the result for the next call to read. This >has the advantage that it would probably work (based on Christopher's >comment and my own experimentation with read() vs. select()), but it >looks like a heck-of-a-lot of work (read: prone to bugs) to solve such a >stupid problem. Actually, suggestion #1 suffers from this con as well. Your analysis is correct, IMO. I've been mulling this over for a couple of years and have never come up with a satisfactory solution. Even the thread method is prone to difficulties. If you are blocked on a read of a pipe, terminating the thread cleanly becomes problematic. It's been some time since I mentioned that "I hate Windows 9x." This seems like a good place to bring this up. >Any suggestions, comments, retorts, complaints about me cluttering up >your email box with trivialities that you don't care about, would be >welcome, er... probably not the last one. I would be really happy if someone had a creative solution to this problem. It would be nice to fix this in the Cygwin DLL. cgf -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com