2019-10-02 14:27:48 +0200, Matteo Croce: [...] > Sometimes bash leaves the pts with O_NONBLOCK set, and all programs > reading from stdin will get an EAGAIN: [...]
Can you reproduce it with bash --norc Or with: INPUTRC=/dev/null bash --norc ? If you could reproduce it with: strace -o strace.log bash --norc that would allow us to see where a O_NONBLOCK flag is set and not reset. BTW, what's the point of the check_dev_tty() function? It seems it just attempts to open the tty (the controlling one or the one open on stdin), closes it, but doesn't return anything about the success of failure in doing so. On my system (Debian amd64, 5.0.3(1)-release, bash started from a regular terminal emulator), it's the only place where I see O_NONBLOCK being used (and that's on a new fd that is closed straight after, so it could not have any bearing on the OP's issue). -- Stephane