Re: bash sets O_NONBLOCK on pts

2019-10-03 Thread Stephane Chazelas
2019-10-03 13:58:40 -0400, Chet Ramey: > On 10/2/19 11:38 AM, Stephane Chazelas wrote: > > > 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 > >

Re: bash sets O_NONBLOCK on pts

2019-10-03 Thread Chet Ramey
On 10/2/19 11:38 AM, Stephane Chazelas wrote: > 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. It's to make up f

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Stephane Chazelas
2019-10-03 02:49:36 +0900, Andrew Church: > >Well, it's not so uncommon, I had it a few times. Reading on internet > >it seems that other users have it but don't notice it. > > The fault could be in some other program accessing the terminal. Bash > does not clear O_NONBLOCK on displaying a prompt

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Matteo Croce
On Wed, Oct 2, 2019 at 8:16 PM Andreas Schwab wrote: > > On Okt 02 2019, Matteo Croce wrote: > > > It seems to me that bash restores the flag, cat prints an error when not: > > > > $ cat > > $ > > > > the same is not true if running multiple commands: > > > > $ ./foo; cat > > cat: -: Resource tem

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Andreas Schwab
On Okt 02 2019, Matteo Croce wrote: > It seems to me that bash restores the flag, cat prints an error when not: > > $ cat > $ > > the same is not true if running multiple commands: > > $ ./foo; cat > cat: -: Resource temporarily unavailable > $ > > Why this different behaviour? Because it's rese

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Matteo Croce
On Wed, Oct 2, 2019 at 7:50 PM Andrew Church wrote: > > >Well, it's not so uncommon, I had it a few times. Reading on internet > >it seems that other users have it but don't notice it. > > The fault could be in some other program accessing the terminal. Bash > does not clear O_NONBLOCK on display

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Andrew Church
>Well, it's not so uncommon, I had it a few times. Reading on internet >it seems that other users have it but don't notice it. The fault could be in some other program accessing the terminal. Bash does not clear O_NONBLOCK on displaying a prompt, so if a previously executed program sets O_NONBLOC

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Matteo Croce
On Wed, Oct 2, 2019 at 4:28 PM Chet Ramey wrote: > > On 10/2/19 8:27 AM, Matteo Croce wrote: > > > Bash Version: 5.0 > > Patch Level: 7 > > Release Status: release > > > > Description: > > Sometimes bash leaves the pts with O_NONBLOCK set, and all programs > > reading from stdin will get an EAGAIN

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Stephane Chazelas
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 -

Re: bash sets O_NONBLOCK on pts

2019-10-02 Thread Chet Ramey
On 10/2/19 8:27 AM, Matteo Croce wrote: > Bash Version: 5.0 > Patch Level: 7 > Release Status: release > > Description: > Sometimes bash leaves the pts with O_NONBLOCK set, and all programs > reading from stdin will get an EAGAIN: Without a way to reliably reproduce this, it's just a transient i

bash sets O_NONBLOCK on pts

2019-10-02 Thread Matteo Croce
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: linux-gnu Compiler: gcc Compilation CFLAGS: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/li