Excellent sleuthing. Unfortunately there are a lot of old OpenSSH versions out there.
My RHEL5.8 system has OpenSSH_4.3p2, which has the problem and my RHEL6.3 system has OpenSSH_5.3p1, which still has the problem. So it seems that any RHEL user will have the problem. If it was up to me I think this means that --ctrl-c should default to off. I'll leave the resolution up to you but please make sure if --ctrl-c is turned on by default there is a way to turn it off. Thank you. -- Allyn Fratkin [email protected] Hewlett-Packard Company http://www.fratkin.com/ -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Ole Tange Sent: Saturday, May 11, 2013 9:03 AM To: Fratkin, Allyn Cc: [email protected] Subject: Re: tcgetattr: Invalid argument and --ctrl-c On Thu, May 9, 2013 at 8:11 PM, Fratkin, Allyn <[email protected]> wrote: > Perhaps the error is specific to Red Hat? I reproduced it with remote hosts > running RHEL 5.2, 5.8, 6.3. The local host is RHEL 5.8. > > ANY invocation of stty, even without arguments, provokes the "tcgetattr: > Invalid argument" error message. > > [afratkin@vl001 src]$ echo hello | ssh -tt -oLogLevel=quiet g4t0930c stty | > cat # RHEL 5.2 > tcgetattr: Invalid argument The problem is not due to stty, but due to the version of ssh. $ ./ssh -V OpenSSH_3.6.1p2, SSH protocols 1.5/2.0, OpenSSL 0x1000100f $ true | ./ssh -tt lo echo FOO tcsetattr: Invalid argument FOO Connection to lo closed. $ ssh -V OpenSSH_5.9p1 Debian-5ubuntu1.1, OpenSSL 1.0.1 14 Mar 2012 $ true | ssh -tt lo echo FOO FOO Connection to lo closed. The problem is due to this line in OpenSSH: sshtty.c: enter_raw_mode(void): [...] if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) perror("tcsetattr"); The error does not harm, but it would be nice if it was possible to ignore it. I have not found a way. I see several options: * live with the error on systems that use an old version of ssh * go back to the situation where --ctrl-c is not default (thus ctrl-c will no propagate to remote hosts) * find a way to give each ssh a pty (openpty() looks promising except it seems not to work on old versions of Perl). This might make it possible to also propagate ctrl-z to suspend remote jobs if parallel is suspended, which would be neat. * find a way to ignore the error in ssh. A dirty way of doing that is when printing the cached stderr: Skip the first line if it is "tcsetattr: Invalid argument". This would of course only work if stderr is cached (i.e. not --ungroup). /Ole
