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


Groups > gnu.bash.bug > #15758 > unrolled thread

Fwd: read -t 0 fails to detect input.

Started byBize Ma <binaryzebra@gmail.com>
First post2019-12-19 19:07 -0400
Last post2019-12-19 19:07 -0400
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#15758 — Fwd: read -t 0 fails to detect input.

FromBize Ma <binaryzebra@gmail.com>
Date2019-12-19 19:07 -0400
SubjectFwd: read -t 0 fails to detect input.
Message-ID<mailman.1160.1576796891.1979.bug-bash@gnu.org>
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>

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web