[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: read with very small timeout sometime hand on stdin
From: |
felix |
Subject: |
Re: read with very small timeout sometime hand on stdin |
Date: |
Sun, 1 Nov 2020 10:29:11 +0100 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
On Thu, Oct 29, 2020 at 01:57:33PM +0100, felix wrote:
> > I can't reproduce this using the following stripped-down reproducer:
Sorry to insist, but... This is not easy because not constant.
For this, I wrote a little script tested on several host, then searching
for installation that was not mine... Tested at https://www.jdoodle.com/ia/3EO
$ sed <<"eotest" >/tmp/test-timeout-race.sh 's/^ //'
#!/bin/bash
declare -p BASH_VERSI{NFO,ON}
uptime
uname -a
po() {
for f in {1..10000};do
read -t .000001 v
rc=$?
[ $rc -ne 142 ] || [ "$v" ] &&
echo f:$f, v:$v, RC:$rc.
done < <(
for i in {1..10000};do sleep 3;echo Timed;done
)
}
exec 2>&1
TIMEFORMAT="U:%U S:%S R:%R"
for test in {1..20};do
time po
done
eotest
If first test don't show strange** output, run test again.
(** lines begining by `f:`)
--
FĂ©lix Hauri - <felix@f-hauri.ch> - http://www.f-hauri.ch
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: read with very small timeout sometime hand on stdin,
felix <=