From mboxrd@z Thu Jan 1 00:00:00 1970 From: Patrick Doyle To: ehud@unix.simonwiesel.co.il Cc: cygwin@cygwin.com Subject: Re: Why does scp leave ssh running? -- select() never returns Date: Mon, 08 Jan 2001 06:24:00 -0000 Message-id: <3A59CDDD.A1A90194@delcomsys.com> References: <3A22C383.5C16BBC8@delcomsys.com> <3A25C7DA.6F76C8DA@delcomsys.com> <20001129224015.B21867@redhat.com> <3A266130.F5877EB5@delcomsys.com> <3A271DCD.99BDDBF5@delcomsys.com> <20001202200832.A18661@redhat.com> <3A29C260.1C491A30@delcomsys.com> <20001202233944.A19867@redhat.com> <3A2A16B5.E1C3F9F4@redhat.com> <3A351ADE.EF54C845@delcomsys.com> <20001211133605.B7497@redhat.com> <3A352393.4D8645EC@delcomsys.com> <3A57E0F0.3FE252BD@delcomsys.com> <200101081121.NAA25063@linux.> X-SW-Source: 2001-01/msg00280.html 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