Hello list.

The following script can be used to reproduce the problem. It seems to be
related to sub-processes terminating at the "wrong" moment. The symptom:
The script runs for some time counting up until at some moment the script
hangs in the read function. Once this happens, the timeout is no longer
respected at all. Only a keypress frees the script again.

Tested versions:
        bash-5.1.16 with readline 8.1.2
        bash-5.2.15 with readline 8.2.1

Regards, Bodo

#! /bin/bash

i=0
bug=true # With bug=false the bug disappears

while true
do
        let i=i+1
        if $bug
        then
                sleep 1 &
        fi
        echo -en "\r>>> $i"
        read -s -n999 -t0.01 key
        echo -en "\r<<< $i"
done

Reply via email to