[Bug 2797] New: ssh swallows end-of-file on output

bugzilla-daemon at bugzilla.mindrot.org bugzilla-daemon at bugzilla.mindrot.org
Mon Oct 23 07:21:13 AEDT 2017


https://bugzilla.mindrot.org/show_bug.cgi?id=2797

            Bug ID: 2797
           Summary: ssh swallows end-of-file on output
           Product: Portable OpenSSH
           Version: 7.6p1
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P5
         Component: ssh
          Assignee: unassigned-bugs at mindrot.org
          Reporter: openssh at davidnewall.com

Ssh duplicates FILENO_STDOUT and FILENO_STDERR, thus there are two
descriptors for each of those files.  When the remote program closes
its stdout or stderr, the remote sshd sends the appropriate message to
the local ssh which responds by closing the duplicate descriptor, but
the original descriptor remains open.  A program reading from ssh's
stdout (or stderr) cannot tell that the remote program has closed the
file.

This is what should happen:

$ sh -c 'exec cat >&- 2>&-; sleep 5' | { read s || echo eof; }
eof
[then 5 second pause]

This is what happens using ssh:

$ ssh localhost 'exec >&- 2>&-; sleep 5' | { read s || echo eof; }
[5 second pause]
eof

-- 
You are receiving this mail because:
You are watching the assignee of the bug.


More information about the openssh-bugs mailing list