Bug 961

Summary: CVS annotate problems
Product: Portable OpenSSH Reporter: Steinar Bang <sb>
Component: sshAssignee: OpenSSH Bugzilla mailing list <openssh-bugs>
Status: CLOSED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 3.8.1p1   
Hardware: All   
OS: Linux   
Attachments:
Description Flags
Return stdio to blocking before executing shell/command none

Description Steinar Bang 2004-12-10 18:50:53 AEDT
I had a problem that CVS annotate from emacs didn't work.  Lines were missing 
from the output.  I was told on gnu.emacs.help, that this was an SSH/CVS/libc 
interaction problem that also affected other tools such as rsync, and was told 
to make the CVS_RSH enviroment variable point to the following bourne shell 
script:

#!/bin/sh
(ssh "$@" 2>&1 1>&3 | cat) 3>&1 1>&2

Using the script fixed the problem for me, but it would be nice not to need it.
Comment 1 Mark D Baushke 2004-12-10 20:09:35 AEDT
Both cvs-1.11.18 (the stable branch release) and cvs-1.12.10 (the
feature branch release) have a workaround for your problem.

The difficulty is that SSH puts stdout into non-blocking mode via
a redirection of stderr. In turn, this may lead to fwrite() and/or
fflush() failing with EAGAIN which was not expected by previous
versions of CVS (rsh does not exhibit this misbehavior).
Comment 2 Damien Miller 2004-12-10 20:46:07 AEDT
Created attachment 751 [details]
Return stdio to blocking before executing shell/command

I don't recall any of the CVS developers reporting this, but anyway - this
patch resets std{in,out,err} to blocking mode before the command or shell is
executed.
Comment 3 Damien Miller 2004-12-13 12:58:04 AEDT
hm, this may be a bug in Linux's socket or tty code - sshd never touches the
child's fds. This patch therefore just prints:

debug3: fd 0 is not O_NONBLOCK
debug3: fd 1 is not O_NONBLOCK
debug3: fd 2 is not O_NONBLOCK

(tested: Linux, OpenBSD, Solaris 10)
Comment 4 Damien Miller 2005-02-09 16:28:37 AEDT
I don't think there is any more that we can do, and CVS has fixed their problems
at their end.
Comment 5 Darren Tucker 2006-10-07 11:38:10 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.