so-called-hang-on-exit
Jani Jaakkola
jjaakkol at cs.Helsinki.FI
Sat Aug 3 07:32:14 EST 2002
On Wed, 31 Jul 2002, Markus Friedl wrote:
> so, should this go into 3.5?
I vote no, it should not. Here is why:
> + /* allow data loss on pty */
And it indeed happens. After applying this patch, if I say
'ssh -t localhost pico' and then exit pico I get a garbled screen.
Picos screen clearing and terminal attribute resetting escape
sequences are lost because of allowing data loss on pty (pico is just an
example. I guess most tty programs will behave the same.).
Here is another example (my test sshd lives behind port 444):
<CLIP>
$ ssh -t localhost -p 444 exec echo blah
blah
Connection to localhost closed.
$ ssh -t localhost -p 444 exec echo blah
Connection to localhost closed.
$ ssh -t localhost -p 444 exec echo blah
blah
</CLIP>
So sometimes just 'echo blah' is lost.
My suggestion is that instead of just closing the channel when the
session process dies, sshd should effort to empty the pty buffer before
closing the channel. This could be implemented so that
when the session process dies, sshd should read (and buffer) the pty
master data until it gets EAGAIN and then close the channel. All
pending output from dead session processes should allready be in the pty
buffer, so first EAGAIN means that all of it has been read processed.
I guess I will attempt to implement this, but it will take some time (I
will need to learn how session.c and serverloop.c work first).
- Jani
More information about the openssh-unix-dev
mailing list