Bug 3458 - -t option make error message into stdout
Summary: -t option make error message into stdout
Status: CLOSED WORKSFORME
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 9.0p1
Hardware: All All
: P5 enhancement
Assignee: Assigned to nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-08 20:00 AEST by walkerxk@gmail.com
Modified: 2023-03-17 13:41 AEDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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