vscode sets stdin to O_NONBLOCK and breaks bash |
||||||
Issue description
Repro:
1) Install vscode in Debian container
2) Launch "code" from bash
3) stdin is now set to O_NONBLOCK, breaking all sorts of things
example with cat:
smbarber@stretch:~$ cat
cat: -: Resource temporarily unavailable
Something in vscode (electron or vscode itself) is setting stdin (/dev/pts/<pts number>) to O_NONBLOCK and not setting it back. Also doesn't repro in zsh:
zsh:
[smbarber@stretch:~]
% ./test
stdin flags are 0x8002
O_NONBLOCK is false
[smbarber@stretch:~]
% code
[smbarber@stretch:~]
% ./test
stdin flags are 0x8002
O_NONBLOCK is false
bash:
smbarber@stretch:~$ ./test
stdin flags are 0x8002
O_NONBLOCK is false
smbarber@stretch:~$ code
smbarber@stretch:~$ ./test
stdin flags are 0x8802
O_NONBLOCK is true
test program:
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char* argv[]) {
int ret = fcntl(STDIN_FILENO, F_GETFL);
printf("stdin flags are 0x%x\n", ret);
printf("O_NONBLOCK is %s\n", ret & O_NONBLOCK ? "true" : "false");
return 0;
}
,
Apr 7 2018
Okay, this is a known issue that I had hoped most applications wouldn't trigger :( SSH: smbarber@stretch:~$ ls -l /proc/self/fd total 0 lrwx------. 1 smbarber smbarber 64 Apr 7 22:35 0 -> /dev/pts/0 lrwx------. 1 smbarber smbarber 64 Apr 7 22:35 1 -> /dev/pts/0 lrwx------. 1 smbarber smbarber 64 Apr 7 22:35 2 -> /dev/pts/0 vsh, then /bin/login via run_container.sh: smbarber@stretch:~$ ls -l /proc/self/fd total 0 lrwx------. 1 smbarber smbarber 64 Apr 7 22:40 0 -> /dev/pts/2 lrwx------. 1 smbarber smbarber 64 Apr 7 22:40 1 -> /dev/pts/2 lrwx------. 1 smbarber smbarber 64 Apr 7 22:40 2 -> /dev/pts/2 In the vsh case, /dev/pts/2 is referring to a pty in the root namespace, not the container namespace. This breaks lots of software that expects this to be correct, and in particular breaks a few libc functions. See https://github.com/lxc/lxd/issues/936 I think we might want to start running vsh in the container's namespace.
,
Apr 9 2018
,
Apr 23 2018
Issue 829879 has been merged into this issue.
,
May 9 2018
<triage>@smbarber, will this be fixed by the vsh improvements you're working on?</triage>
,
May 9 2018
,
May 23 2018
,
Jun 20 2018
Verified on 10798.0.0 |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by smbar...@chromium.org
, Apr 7 2018