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


Groups > gnu.bash.bug > #15758

Fwd: read -t 0 fails to detect input.

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From Bize Ma <binaryzebra@gmail.com>
Newsgroups gnu.bash.bug
Subject Fwd: read -t 0 fails to detect input.
Date Thu, 19 Dec 2019 19:07:45 -0400
Lines 32
Approved bug-bash@gnu.org
Message-ID <mailman.1160.1576796891.1979.bug-bash@gnu.org> (permalink)
References <CAFra36gNku2DTCyivz+caMGnTf7GvGJUTiWicUnBZatcckXGcQ@mail.gmail.com> <7e6fccb4-e5b5-eb2b-8b12-eeee9d638ae1@case.edu> <CAFra36iJqGfocqtVYqcdfkePJZ5xrWg8=pfKZXymD34Gaz02rA@mail.gmail.com> <CAFra36iUQqc-yUmZyu-3ty15jWiN=5o_XQ8pxLsZieEZP8=Lsw@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 1576796892 13219 209.51.188.17 (19 Dec 2019 23:08:12 GMT)
X-Complaints-To action@cs.stanford.edu
To bug-bash <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=e77WVnV9sq4Zf0Z60FpCBqxadCRqixMD3psTEmdF5TA=; b=MomldJClJCCQ9hRKZwqphCRMg4ggX1T+yViLCmni1shIJD4UBejO86lJ4o46alOuIU QM4jgnS/9rvDXJfcHbN9udag2dklV4pXJIShVzCWYbKuVDnQSBJGAgahcrnIczDwkfXz tUVqRt2g9nwuhKIKRyjOqvll5KhEKM+QUg2HXhI7oXh67XqsOTH/qlgGSqHP8UnZGnqM aLqrGlE7r8KHF/HvZeOhci8RfltBgdIsGErhGRZ5NV61zQsf2kqTqPxEt7QZTS4w+Hq8 KAz2g+XXJ6Dxp2f9uQqm5DgMXpBb7CC30OSf9F0Vz9aSSAgVSAkLpKkbBszyZ7hVIWTY lS9Q==
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; bh=e77WVnV9sq4Zf0Z60FpCBqxadCRqixMD3psTEmdF5TA=; b=t3Wv59q2sDLKkOvzIxnsO3iwd2/nX0flxMZGrNMOVmVbozfbuum4DknSOE4/Fjtb7m Plrc7T0MEetmfpk3dYj7OwQlc+9y7vObgfQ73ksSgmnY/FrQ4TBOoPRJJVyIceCNLBie jiqbMpTf1DqBdhY8BP/3npzi3K+JdUznHsHUXhnKPWojddoznGnPYoznGoZEpHlCkewa 80hO8ObKj9wsD1cdyClUHKyc9lMbbnb4QunCL6GoBoxRgUCPZ3lnoOFPdJeXZSqQLRHH YHlhnJil/1JwVQU20a9VAxbp4RAgffs6fxY79oTtPpPYMRmgLSGX2Z4YoofTfPJb5Q+S Y8vA==
X-Gm-Message-State APjAAAWXbhet6a+IDq+BnRIf7kQToJoxv33sgXNBE8RzhP5FQahGNxwU P238DNnZ4ZO27ajfuAIRsVKWW/vOYCVWNoOTaUaexA==
X-Google-Smtp-Source APXvYqxNcMfMv2ubYtpy4+lgRmCFxSsNfs5Q3Su97ehgKZ1r8GGQiiNQ6NiPOxT4PRmhR75zuy1BpPONOkwRyPi6HK4=
X-Received by 2002:aca:f456:: with SMTP id s83mr3000005oih.12.1576796886155; Thu, 19 Dec 2019 15:08:06 -0800 (PST)
In-Reply-To <CAFra36iJqGfocqtVYqcdfkePJZ5xrWg8=pfKZXymD34Gaz02rA@mail.gmail.com>
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 2607:f8b0:4864:20::22a
X-Content-Filtered-By Mailman/MimeDel 2.1.23
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 <CAFra36iUQqc-yUmZyu-3ty15jWiN=5o_XQ8pxLsZieEZP8=Lsw@mail.gmail.com>
X-Mailman-Original-References <CAFra36gNku2DTCyivz+caMGnTf7GvGJUTiWicUnBZatcckXGcQ@mail.gmail.com> <7e6fccb4-e5b5-eb2b-8b12-eeee9d638ae1@case.edu> <CAFra36iJqGfocqtVYqcdfkePJZ5xrWg8=pfKZXymD34Gaz02rA@mail.gmail.com>
Xref csiph.com gnu.bash.bug:15758

Show key headers only | View raw


To: Chester Ramey <chet.ramey@case.edu>

On thu., dec. 19 of 2019 at 12:40, Chet Ramey (<chet.ramey@case.edu>) wrote:

> On 12/18/19 6:40 PM, Bize Ma wrote:
>


> >>> The exit status is 0 if input is available on the specified file
> >   descriptor, non-zero otherwise.
>
> Bash-5.0 uses select/FIONREAD to determine whether or not there is input
> available on the file descriptor. Those don't wait; they test whether or
> not there is input on the specified file descriptor at the point they are
> called.
>

Thanks Chet.

Could you please comment about this assertions:

 1.-   bash will either do a select() or an ioctl(FIONREAD), or neither of
them, but not both, as it should for it to work. read -t0 is broken. Do not
use it – mosvy.
<https://unix.stackexchange.com/questions/33049/how-to-check-if-a-pipe-is-empty-and-run-a-command-on-the-data-if-it-isnt/498064#comment969997_498064>
 2.- Conclusion: read -t0 is *broken* in bash. Don't use it. –
<https://unix.stackexchange.com/users/308316/mosvy> mosvy
<https://unix.stackexchange.com/questions/33049/how-to-check-if-a-pipe-is-empty-and-run-a-command-on-the-data-if-it-isnt/498065?noredirect=1#comment916652_497121>

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


Thread

Fwd: read -t 0 fails to detect input. Bize Ma <binaryzebra@gmail.com> - 2019-12-19 19:07 -0400

csiph-web