Nicolas.Williams at Nicolas.Williams at
Tue Aug 6 00:01:18 EST 2002

I still think this sort of thing should be done by the client.

The client knows everything that the server knows. So the client
can choose to terminate the SSHv2 session when the PTY session
process leader exits - and it can implement any other termination
heuristic you wish too.


> -----Original Message-----
> From: Jani Jaakkola [mailto:jjaakkol at]
> Sent: Saturday, August 03, 2002 3:02 PM
> To: openssh-unix-dev at
> Subject: Re: so-called-hang-on-exit


> OK, now I have implemented it. Currently only for protocol 2, but a 
> similar thing can be implemented for protocol 1 (and the 
> protocol 1 patch 
> would be simpler).
> Here is what it does (or should do; I have made mistakes before):
> - Applies against openssh-3.4p1
> - This patch only changes behavior of ssh protocol 2 sessions 
> with a tty.
>   Everything else should remain as it was.
> - It does its job by reading all immediately available data from the
>   pty when the pty session process dies. This should include all data
>   from the pty session foreground processes.
> - It can and will lose data from pty session background processes.
> - It might still hang indefinetely, if the background processes keep
>   producing more data than the sshd process can read and transfer to 
>   client (so that pty buffer will never get completely 
> empty). I consider 
>   this a feature of this solution, not a bug.


Visit our website at

This message contains confidential information and is intended only 
for the individual named.  If you are not the named addressee you 
should not disseminate, distribute or copy this e-mail.  Please 
notify the sender immediately by e-mail if you have received this 
e-mail by mistake and delete this e-mail from your system.

E-mail transmission cannot be guaranteed to be secure or error-free 
as information could be intercepted, corrupted, lost, destroyed, 
arrive late or incomplete, or contain viruses.  The sender therefore 
does not accept liability for any errors or omissions in the contents 
of this message which arise as a result of e-mail transmission.  If 
verification is required please request a hard-copy version.  This 
message is provided for informational purposes and should not be 
construed as a solicitation or offer to buy or sell any securities or 
related financial instruments.

More information about the openssh-unix-dev mailing list