Subject: pkg/9119: sshd truncates output
To: None <gnats-bugs@gnats.netbsd.org>
From: Michael Eriksson T/K 2 <Michael.Eriksson@era-t.ericsson.se>
List: netbsd-bugs
Date: 01/04/2000 15:18:39
>Number:         9119
>Category:       pkg
>Synopsis:       sshd truncates output
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan  4 15:18:00 2000
>Last-Modified:
>Originator:     Michael Eriksson
>Organization:
Ericsson Radio Systems AB
>Release:        Doesn't matter
>Environment:
System: NetBSD burken 1.4P NetBSD 1.4P (EMT) #0: Mon Dec 27 11:11:51 CET 1999 eramore@burken:/var/home/eramore/wrk/maestro2/sys/arch/i386/compile/EMT i386


>Description:

sshd truncates any outstanding output when the process it starts dies.
This is completely brain-dead, but I guess it's done because of some
unknown limitations in some obscure OS. Anyway, NetBSD can do much
better than that, and doesn't need the brain-damaged code.

>How-To-Repeat:

% ssh remote-host cat big-file

Watch the output get truncated (or not, depending on machines,
networks and the phase of the moon).

>Fix:

--- serverloop.c.orig	Wed May 12 13:19:28 1999
+++ serverloop.c	Tue Jun 29 09:14:24 1999
@@ -377,10 +377,12 @@
   if (channel_max_fd() > max_fd)
     max_fd = channel_max_fd();
   
+#if 0 /* Ohh, this sucks so badly I almost weep... */
   /* If child has terminated, read as much as is available and then exit. */
   if (child_terminated)
     if (max_time_milliseconds == 0)
       max_time_milliseconds = 100;
+#endif
 
   if (idle_timeout != 0 &&
       (max_time_milliseconds == 0 ||
@@ -421,6 +423,7 @@
       FD_ZERO(writeset);
     }
   
+#if 0 /* Ohh, this sucks so badly I almost weep... */
   /* If the child has terminated and there was no data, shutdown all
      descriptors to it. */
   if (ret <= 0 && child_terminated && !child_just_terminated)
@@ -442,6 +445,7 @@
       fdin = -1;
     }
   else
+#endif
     {
       if (ret == 0)             /* Nothing read, timeout expired */
         {

>Audit-Trail:
>Unformatted: