On Wed, Oct 28, 2020 at 09:23:09AM -0400, Chet Ramey wrote: > > I can't reproduce this using the following stripped-down reproducer:
> trap 'echo $f ; exit' SIGINT > > for f in {1..10000}; do > read -t .000001 v > if [ $? -ne 142 ]; then > echo $f: $? > fi > done This is strange: $? seem to be alway 142! On my host: Debian 10.4 - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz - 32Gb ram $ TIMEFORMAT="U:%U S:%S R:%R" $ time for f in {1..1000};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..1000};do sleep 3;echo;done) U:0.206 S:0.032 R:0.240 $ time for f in {1..1000};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..1000};do sleep 3;echo;done) U:0.167 S:0.068 R:0.236 $ time for f in {1..1000};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..1000};do sleep 3;echo;done) U:0.207 S:0.049 R:24.152 $ time for f in {1..1000};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..1000};do sleep 3;echo;done) U:0.177 S:0.067 R:6.233 Where 6 second seem represent two `sleep 3;echo` ... Same on my raspberry-pi (BCM2835 ARMv6-compatible rev 7 (v6l) - 512M), Machine Type: armv6l-unknown-linux-gnueabihf - 5.1.0.rc1 ...but with 100 loop and 10 second sleep: $ TIMEFORMAT="U:%U S:%S R:%R" $ time for f in {1..100};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..100};do sleep 10;echo;done ) U:0.447 S:0.021 R:0.995 $ time for f in {1..100};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..100};do sleep 10;echo;done ) U:8.589 S:0.108 R:10.918 $ time for f in {1..100};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..100};do sleep 10;echo;done ) U:0.445 S:0.022 R:0.999 $ time for f in {1..100};do read -t .000001 v; [ $? -ne 142 ] && echo f:$f, v:$v, RC:$?. ; done < <( for i in {1..100};do sleep 10;echo;done ) U:0.540 S:0.065 R:10.958 Again, no output! (Result code seem to be alway 142) But clearly without `sleep 10; echo` loop as input, this test may hang... until you hit <return>... maybe several times... Nota: None of the host used to make this tests are really ``quiet'': My host loadavg: 0.48 0.78 0.91 2/1074 15425 Raspbery load : 0.93 1.01 1.12 2/87 28120 This seem harder to reproduce on quiet system Other host load: 0.00 0.04 0.00 1/772 468 U:0.015 S:0.008 R:0.023 U:0.021 S:0.000 R:0.023 U:0.021 S:0.000 R:0.022 U:0.015 S:0.010 R:3.023 U:0.015 S:0.004 R:0.020 U:0.018 S:0.004 R:0.023 U:0.010 S:0.008 R:0.019 U:0.010 S:0.012 R:0.023 U:0.023 S:0.000 R:0.024 U:0.015 S:0.004 R:0.020 U:0.019 S:0.000 R:0.020 U:0.015 S:0.008 R:0.023 U:0.038 S:0.008 R:3.023 U:0.023 S:0.000 R:0.023 U:0.030 S:0.000 R:3.025 U:0.009 S:0.008 R:0.018 U:0.020 S:0.007 R:3.031 -- Félix Hauri - <fe...@f-hauri.ch> - http://www.f-hauri.ch