Bug 3458

Summary: -t option make error message into stdout
Product: Portable OpenSSH Reporter: walkerxk <walkerxk>
Component: sshAssignee: Assigned to nobody <unassigned-bugs>
Status: CLOSED WORKSFORME    
Severity: enhancement CC: djm, dtucker
Priority: P5    
Version: 9.0p1   
Hardware: All   
OS: All   

Description walkerxk@gmail.com 2022-07-08 20:00:13 AEST
when i don't use -t option, error message keep in stderr
when i use -t option, error message was sent into stdout
how to reproduce
walkerxk@ubuntu:~$ ssh 127.1 ls -d $(mktemp -u) 2>/dev/null
walkerxk@ubuntu:~$ ssh -t 127.1 ls -d $(mktemp -u) 2>/dev/null
ls: cannot access '/tmp/tmp.tckToRNwR7': No such file or directory
walkerxk@ubuntu:~$
Comment 1 walkerxk@gmail.com 2022-07-13 18:28:24 AEST
-t also change \n to \r\n:
walkerxk@ubuntu:~$ echo -e 'a\nb' >test
walkerxk@ubuntu:~$ ssh 127.1 cat test|xxd
00000000: 610a 620a                                a.b.
walkerxk@ubuntu:~$ ssh -t 127.1 cat test|xxd
00000000: 610d 0a62 0d0a                           a..b..
                                                         walkerxk@ubuntu:~$
Comment 2 Darren Tucker 2022-07-14 10:09:48 AEST
(In reply to walkerxk@gmail.com from comment #1)
> -t also change \n to \r\n:

That's a function of the client's terminal's "cooked" mode.  If you don't want it to do that you need to tell it to use "raw" mode.

$ stty raw
$ ssh -t 127.1 cat test|xxd
00000000: 610a 620a                                a.b.

$ ssty cooked
$ ssh -t 127.1 cat test|xxd
00000000: 610d 0a62 0d0a                           a..b..
Comment 3 walkerxk@gmail.com 2022-07-14 11:45:57 AEST
thanks, stty -opost will fix it.
Comment 4 Damien Miller 2023-03-17 13:41:53 AEDT
OpenSSH 9.3 has been released. Close resolved bugs