{"action":"closed","issue":{"url":"https://api.github.com/repos/golang/go/issues/15625","repository_url":"https://api.github.com/repos/golang/go","labels_url":"https://api.github.com/repos/golang/go/issues/15625/labels{/name}","comments_url":"https://api.github.com/repos/golang/go/issues/15625/comments","events_url":"https://api.github.com/repos/golang/go/issues/15625/events","html_url":"https://github.com/golang/go/issues/15625","id":153912046,"number":15625,"title":"crypto/ssh/terminal: MakeRaw() does not unset the OPOST flag","user":{"login":"fdawg4l","id":4296242,"avatar_url":"https://avatars.githubusercontent.com/u/4296242?v=3","gravatar_id":"","url":"https://api.github.com/users/fdawg4l","html_url":"https://github.com/fdawg4l","followers_url":"https://api.github.com/users/fdawg4l/followers","following_url":"https://api.github.com/users/fdawg4l/following{/other_user}","gists_url":"https://api.github.com/users/fdawg4l/gists{/gist_id}","starred_url":"https://api.github.com/users/fdawg4l/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fdawg4l/subscriptions","organizations_url":"https://api.github.com/users/fdawg4l/orgs","repos_url":"https://api.github.com/users/fdawg4l/repos","events_url":"https://api.github.com/users/fdawg4l/events{/privacy}","received_events_url":"https://api.github.com/users/fdawg4l/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-10T02:37:50Z","updated_at":"2016-05-10T02:40:42Z","closed_at":"2016-05-10T02:40:42Z","body":"Please answer these questions before submitting your issue. Thanks!\r\n\r\n1. What version of Go are you using (`go version`)?\r\ngo1.6.2\r\n\r\n2. What operating system and processor architecture are you using (`go env`)?\r\nGOARCH=\"amd64\"\r\nGOBIN=\"\"\r\nGOEXE=\"\"\r\nGOHOSTARCH=\"amd64\"\r\nGOHOSTOS=\"linux\"\r\nGOOS=\"linux\"\r\nGOPATH=\"/home/fahmed/src/go\"\r\nGORACE=\"\"\r\nGOROOT=\"/usr/local/go\"\r\nGOTOOLDIR=\"/usr/local/go/pkg/tool/linux_amd64\"\r\nGO15VENDOREXPERIMENT=\"1\"\r\nCC=\"gcc\"\r\nGOGCCFLAGS=\"-fPIC -m64 -pthread -fmessage-length=0\"\r\nCXX=\"g++\"\r\nCGO_ENABLED=\"1\"\r\n\r\n\r\n3. What did you do?\r\nIf possible, provide a recipe for reproducing the error.\r\nA complete runnable program is good.\r\nA link on play.golang.org is best.\r\n\r\nThe `stty` utility can set a serial device to raw mode as such.\r\n```\r\n# Set to raw\r\n$ sudo stty -F /dev/ttyS0 raw\r\n\r\n# Inspect settings.   Notice the presence of the -opost flag.\r\n$ sudo stty -F /dev/ttyS0\r\nspeed 9600 baud; line = 0;\r\nmin = 1; time = 0;\r\n-brkint -icrnl -imaxbel\r\n-opost\r\n-isig -icanon -echo\r\n```\r\n\r\nThe `-opost` flag suppresses post processing used by terminals to send/interpret exit codes (color, carriage returns, etc.). \r\n\r\nUsing the `MakeRaw` method in the `ssh/terminal` package should give us the same results.  Example code can be found [here](https://play.golang.org/p/_LFLN6rBXH). \r\n\r\n4. What did you expect to see?\r\n\r\nRunning the above snippet should add the `-opost` flag (e.g. unseting the `syscall.OPOST` bit), but it does not. \r\n\r\n5. What did you see instead?\r\n\r\nInstead of seeing `-opost` in the output of `stty` after running the above snippet, we see the following\r\n\r\n```\r\n# Before issuing\r\n$ sudo stty -F /dev/ttyS0\r\nspeed 9600 baud; line = 0;\r\n-imaxbel\r\n-echo\r\n\r\n\r\nfahmed@hasselhoff: ~/src/crypto/src/github.com/fdawg4l/setraw$ sudo ./setraw \r\nsetting terminal to raw mode\r\ns = &terminal.State{termios:syscall.Termios{Iflag:0x526, Oflag:0x5, Cflag:0xcbd, Lflag:0x8a33, Line:0x0, Cc:[32]uint8{0x3, 0x1c, 0x7f, 0x15, 0x4, 0x0, 0x1, 0x0, 0x11, 0x13, 0x1a, 0x0, 0x12, 0xf, 0x17, 0x16, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, Pad_cgo_0:[3]uint8{0x0, 0x0, 0x0}, Ispeed:0x0, Ospeed:0x0}}f\r\n\r\n# Check what was set.  Notice the lack of -opost as in (3) above.\r\n$ sudo stty -F /dev/ttyS0\r\nspeed 9600 baud; line = 0;\r\nmin = 1; time = 0;\r\n-icrnl -imaxbel\r\n-isig -icanon -echo\r\n```\r\n"}}