Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #15463

Re: bash sets O_NONBLOCK on pts

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Matteo Croce <mcroce@redhat.com>
Newsgroups gnu.bash.bug
Subject Re: bash sets O_NONBLOCK on pts
Date Wed, 2 Oct 2019 19:59:24 +0200
Lines 42
Approved bug-bash@gnu.org
Message-ID <mailman.788.1570039210.2651.bug-bash@gnu.org> (permalink)
References <CAGnkfhzCqfL03_Ox+awRvd2gmu+OQy4J8qbzQLiaO3sQgQcGqA@mail.gmail.com> <5d94e361.21745@msgid.achurch.org> <CAGnkfhwz-1DE+yKFGi-yCviQeAE_2h2-p7rhA1xOt7pPzXBdkg@mail.gmail.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1570039211 12917 209.51.188.17 (2 Oct 2019 18:00:11 GMT)
X-Complaints-To action@cs.stanford.edu
Cc bug-bash@gnu.org
To Andrew Church <achurch@achurch.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1570039205; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9EoVFhHwK/iBG0cbyaChbRCxxOLt7ywYiNY4ZDptp60=; b=YfP8jzXI3K3Egp43UiqpZtb+a2RIDAe09gr7ueEgUwCIjmHl+JR9kAQWXF2k2qB87/TteO lVlIJBn/IWDi1cgfglzu0KdL4oXRZ6ZsGL2v7EMyOO2AOT55sR8nlv13hjQOcC9seFRQz1 ALT0r/uiadzqxitsfGXKiEwzGdW43xM=
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=9EoVFhHwK/iBG0cbyaChbRCxxOLt7ywYiNY4ZDptp60=; b=WxJ42I2tuLRu4CZx4Ox8NMYw4lMkkWWDpuyOvHQZCLxnEtXP7PuooSEKh4PiZvbGPa TimKuY3OTCNAk+Ww7GiV+dxg4WTFip5KOVfJitiWsL6kl9YTJXtii7AxAS30npMVYbo+ v7l3I/daH7UJxuwjnSDETgQsZrZFyDu3tzasmyS2NCQlW5zzHBAMBvgzYCFMh1CxTdDY +xHXJXq+fUSBRKqVEfYxiuski5xofYWIU0rgGSf67LSq2O100w9mUMTcVHJGs45bfd6S A7dzTe8boTuhlijuCvJ59iSuybQAD6MCSSdG51b7giGkimVFP/Ia6c+c8P518aKDTH5M ML5A==
X-Gm-Message-State APjAAAWHyDS6YLujYTs2HrwI/WLePL1i4rNP73Z4EDuWDl8mmfonbRzi pEgjmOtdEBAMzrPvZLe1MqDeX+jfPK29mPWjWV+ny40ZFvphbo7Y+op7b7WS46bYWjP5gEG/H9m 088BEqn0tWgwchwrA/9yS9l7G
X-Received by 2002:ac2:4567:: with SMTP id k7mr3176615lfm.46.1570039201152; Wed, 02 Oct 2019 11:00:01 -0700 (PDT)
X-Google-Smtp-Source APXvYqwVo2APnHkgCdOq2URBM1F6w/IBWUZEOs57pdOKwYKpg6afn7d9kTkj2OYxMJMldK+2fqMnYpTCxdgQBwuo40w=
X-Received by 2002:ac2:4567:: with SMTP id k7mr3176591lfm.46.1570039200832; Wed, 02 Oct 2019 11:00:00 -0700 (PDT)
In-Reply-To <5d94e361.21745@msgid.achurch.org>
X-MC-Unique 3dopDtENMIe5gwx5eJjtAQ-1
X-Mimecast-Spam-Score 0
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy]
X-Received-From 205.139.110.120
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.23
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <https://lists.gnu.org/archive/html/bug-bash>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
X-Mailman-Original-Message-ID <CAGnkfhwz-1DE+yKFGi-yCviQeAE_2h2-p7rhA1xOt7pPzXBdkg@mail.gmail.com>
X-Mailman-Original-References <CAGnkfhzCqfL03_Ox+awRvd2gmu+OQy4J8qbzQLiaO3sQgQcGqA@mail.gmail.com> <5d94e361.21745@msgid.achurch.org>
Xref csiph.com gnu.bash.bug:15463

Show key headers only | View raw


On Wed, Oct 2, 2019 at 7:50 PM Andrew Church <achurch@achurch.org> 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 displaying a prompt, so if a previously
> executed program sets O_NONBLOCK on stdin and then exits, that state
> will remain until some other program unsets it.  For example:
>
> $ cat >foo.c
> #include <fcntl.h>
> int main(void) {fcntl(0, F_SETFL, O_NONBLOCK); return 0;}
> ^D
> $ cc foo.c
> $ ./a.out
> $ cat
> cat: -: Resource temporarily unavailable
>
>   --Andrew Church
>     http://achurch.org/

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?

Regards,

--
Matteo Croce
per aspera ad upstream

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: bash sets O_NONBLOCK on pts Matteo Croce <mcroce@redhat.com> - 2019-10-02 19:59 +0200

csiph-web