[Bug 209509] EAGAIN on shell pipes / O_NONBLOCK error in kernel ?

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat May 14 23:47:06 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=209509

Jilles Tjoelker <jilles at FreeBSD.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jilles at FreeBSD.org

--- Comment #3 from Jilles Tjoelker <jilles at FreeBSD.org> ---
The problem may be caused by ssh. When it starts, ssh sets fd 0, 1 and 2 to
non-blocking mode if they are not TTYs, restoring them to their original state
on exit. This causes breakage if you use the open files (pipes or sockets) for
other things while ssh is running.

Unfortunately, fixing ssh requires adding threads or processes to do blocking
reads and writes. On FreeBSD, although socket receives support MSG_DONTWAIT,
socket sends do not (although their behaviour is affected by it slightly) and
pipe reads and writes do not support anything like it. Performance of common
use cases may be affected negatively.

As a workaround, try redirecting ssh's stderr through a 'cat'. For example,

{ ssh ... 2>&1 >&3 3>&- | cat >&2; } 3>&1

(Bug: this example loses ssh's exit status. Using fifos or doing pipe
manipulations from C will avoid that.)

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


More information about the freebsd-bugs mailing list