Why does scp leave ssh running? -- select() never returns
Thu Nov 30 19:40:00 GMT 2000
> Christopher Faylor wrote:
> > On Wed, Nov 29, 2000 at 10:22:03PM -0500, Patrick Doyle wrote:
> > >1) Is this behavior (of PeekNamedPipe()) a W9x bug? (That is, does it
> > >work correctly on NT/2K?)
> > I think you are correct. It is a w9x bug. I vaguely recall seeing this
> > before.
> > I can't think of any way to work around this, unfortunately. I remember trying
> > things like zero byte reads on the pipe but they didn't do anything.
> > The only way to trigger the EOF is to actually read from the pipe.
> > cgf
> 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 ...
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
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.
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.
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.
Want to unsubscribe from this list?
Send a message to email@example.com
More information about the Cygwin