{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/28009","repository_url":"https://api.github.com/repos/docker/docker","labels_url":"https://api.github.com/repos/docker/docker/issues/28009/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/28009/comments","events_url":"https://api.github.com/repos/docker/docker/issues/28009/events","html_url":"https://github.com/docker/docker/issues/28009","id":186957196,"number":28009,"title":"Terminal setting are initialized asynchronously after container is already up and running","user":{"login":"iltish","id":23225158,"avatar_url":"https://avatars.githubusercontent.com/u/23225158?v=3","gravatar_id":"","url":"https://api.github.com/users/iltish","html_url":"https://github.com/iltish","followers_url":"https://api.github.com/users/iltish/followers","following_url":"https://api.github.com/users/iltish/following{/other_user}","gists_url":"https://api.github.com/users/iltish/gists{/gist_id}","starred_url":"https://api.github.com/users/iltish/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iltish/subscriptions","organizations_url":"https://api.github.com/users/iltish/orgs","repos_url":"https://api.github.com/users/iltish/repos","events_url":"https://api.github.com/users/iltish/events{/privacy}","received_events_url":"https://api.github.com/users/iltish/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-03T00:45:25Z","updated_at":"2016-11-03T00:51:19Z","closed_at":"2016-11-03T00:51:19Z","body":"Looks like starting docker container with **-ti** sets terminal settings while processes inside container are already up and running. This causes some programs (like **rlwrap**) to fail due to the uninitialized terminal settings.\r\n\r\nIf you put **sleep** even for a very short period of time in front of the command, terminal settings become initialized properly.\r\n\r\nThis issue was reproduced on Ubuntu and MacOS. However, since this is a race condition, it depends on system speed and current load.\r\n\r\nConfiguration:\r\n```\r\n>uname -a\r\nLinux ldev1 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux\r\n>docker -v\r\nDocker version 1.12.1, build 23cf638\r\n```\r\n\r\n**rlwrap** works only after sleep command:\r\n```\r\n>docker run -ti ubuntu_with_rlwrap bash -c \"rlwrap ls\"\r\nrlwrap: error: My terminal reports width=0 (is it emacs?)  I can't handle this, sorry!\r\n>docker run -ti ubuntu_with_rlwrap bash -c \"sleep 0.0001;rlwrap ls\"\r\nbin  boot  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var\r\n```\r\n\r\nRunning **stty** 3 times in a row, with only the last run showing correct terminal setting:\r\n```\r\n>docker run -ti ubuntu bash -c \"stty -a;stty -a;sleep 0.01;stty -a\"\r\nspeed 38400 baud; rows 0; columns 0; line = 0;\r\nintr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;\r\neol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;\r\nwerase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;\r\n-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts\r\n-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff\r\n-iuclc -ixany -imaxbel -iutf8\r\nopost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\r\nisig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt\r\nechoctl echoke -flusho -extproc\r\nspeed 38400 baud; rows 0; columns 0; line = 0;\r\nintr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>;\r\neol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R;\r\nwerase = ^W; lnext = ^V; discard = ^O; min = 1; time = 0;\r\n-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts\r\n-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff\r\n-iuclc -ixany -imaxbel -iutf8\r\nopost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\r\nisig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt\r\nechoctl echoke -flusho -extproc\r\nspeed 38400 baud; rows 67; columns 198; line = 0;\r\nintr = ^C; quit = ^\\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;\r\nmin = 1; time = 0;\r\n-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts\r\n-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff -iuclc -ixany -imaxbel -iutf8\r\nopost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0\r\nisig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/258042626","html_url":"https://github.com/docker/docker/issues/28009#issuecomment-258042626","issue_url":"https://api.github.com/repos/docker/docker/issues/28009","id":258042626,"user":{"login":"thaJeztah","id":1804568,"avatar_url":"https://avatars.githubusercontent.com/u/1804568?v=3","gravatar_id":"","url":"https://api.github.com/users/thaJeztah","html_url":"https://github.com/thaJeztah","followers_url":"https://api.github.com/users/thaJeztah/followers","following_url":"https://api.github.com/users/thaJeztah/following{/other_user}","gists_url":"https://api.github.com/users/thaJeztah/gists{/gist_id}","starred_url":"https://api.github.com/users/thaJeztah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thaJeztah/subscriptions","organizations_url":"https://api.github.com/users/thaJeztah/orgs","repos_url":"https://api.github.com/users/thaJeztah/repos","events_url":"https://api.github.com/users/thaJeztah/events{/privacy}","received_events_url":"https://api.github.com/users/thaJeztah/received_events","type":"User","site_admin":false},"created_at":"2016-11-03T00:51:19Z","updated_at":"2016-11-03T00:51:19Z","body":"Looks like this is a duplicate of https://github.com/docker/docker/issues/25450, and related https://github.com/docker/docker/issues/10341\r\n\r\nI'll close this issue to keep the discussion on a single place, but let me know if you think it's not a duplicate "}}
{"actor":{"display_login":"thaJeztah"}}