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 Message-ID: <3A59CDDD.A1A90194@delcomsys.com> Date: Mon, 08 Jan 2001 09:25:33 -0500 From: Patrick Doyle X-Mailer: Mozilla 4.76 [en] (Win98; U) X-Accept-Language: en,zh,zh-CN,zh-TW MIME-Version: 1.0 To: ehud AT unix DOT simonwiesel DOT co DOT il CC: cygwin AT cygwin DOT com Subject: Re: Why does scp leave ssh running? -- select() never returns 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> <20001202200832 DOT A18661 AT redhat DOT com> <3A29C260 DOT 1C491A30 AT delcomsys DOT com> <20001202233944 DOT A19867 AT redhat DOT com> <3A2A16B5 DOT E1C3F9F4 AT redhat DOT com> <3A351ADE DOT EF54C845 AT delcomsys DOT com> <20001211133605 DOT B7497 AT redhat DOT com> <3A352393 DOT 4D8645EC AT delcomsys DOT com> <3A57E0F0 DOT 3FE252BD AT delcomsys DOT com> <200101081121 DOT NAA25063 AT linux.> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Ehud Karni wrote: > > On Sat, 06 Jan 2001 22:22:24 -0500, Patrick Doyle wrote: > > > > I have been working on a hack workaround for this problem. (Short > > summary -- select() fails to detect when all of the writers of a pipe > > have closed the pipe because PeekNamedPipe() on W9x boxen fails to > > report when all of the writers of a pipe have closed the pipe. I am > > told that this all works correctly on NT/2K boxen). > > My work around for Win95/98 is a bash script, executed directly from > the windows command (I associated sh with /bin/bash): > Thanks for the excellent script. It looks like it solves the specific problem that I was complaining about (namely that scp leaves an ssh running), but unfortunately it doesn't solve other related problems that share the same root cause. For example, using SSH with CVS appears to hang at the end of the CVS operation. (CVS is waiting for SSH to complete. SSH is waiting to detect an EOF on its input pipe). I am hoping to solve this problem in the cygwil DLL, so that it is solved once, rather than for each application that encounters it. > > Basically, I have modified 'pipe()' to create two windows pipes (on W9x > > boxen). The first pipe is the same one that has always been created. > > [ snip ] > > Well, it seems a very complicated work around for the W9x bug. I would > have taken a much simpler and direct approach like this: > 1) Save the child (ssh) process id in a global variable, > (i.e. child=fork() ;) > 2) Just before exiting, send kill signal to the child with no > checks, (i.e. kill(child, SIGTERM) ;) > > This might look like brute force, but it works. It has the advantage > that it works with ssh unmodified and with any other program that may > be given as argument to scp. > I think that you are saying that your approach would have been to modify scp (and later cvs) to work around this problem. Again, I would rather fix it in the library, and not have to modify each application that runs into this. I admit, my solution is complicated, it is a hack, in the end I may never be able to make it work right, etc..., but, so far, it is the only viable approach that I have been able to envision. Every other approach I have thought of runs into the problem that it depends on capabilities that are in NT/2K, but not W9x. Sigh... I really appreciate Christoper's statement that he hates Window 9x programming. --wpd -- Want to unsubscribe from this list? Check out: http://cygwin.com/ml/#unsubscribe-simple