Opened 7 years ago

Last modified 4 years ago

#9056 new defect

bash: timeout option in read comand operates only one times

Reported by: Jochen Buchholz <bookwood@…> Owned by: developers
Priority: normal Milestone: Chaos Calmer 15.05
Component: packages Version: Trunk
Keywords: bash read timeout Cc:


I installed bash on backfire (10.03.1 rc4 and 10.03 stable) to implement a small setup bash script integrated in the inittab. I want to use the read statement:

read: usage: read [-ers] [-u fd] [-t timeout] [-p prompt] [-a array] [-n nchars] [-d delim] [name ...]

Read ignores, after the first execution, the timout option "-t".
This example runs exactly three seconds on my Gentoo Server:

buchholz@skywalker ~ $ time bash -c "read -t 1 -s -n 1 C; date +%H:%M:%S ; read -t 1 -s -n 1 C ; date +%H:%M:%S; read -t 1 -s -n 1 C ; date +%H:%M:%S"  

real    0m3.014s
user    0m0.030s
sys     0m0.010s
buchholz@skywalker ~ $

On OpenWRT Backfire it runs forever:

root@OpenWrt:~# time bash -c "read -t 1 -s -n 1 C; date +%H:%M:%S ; read -t 1 -s -n 1 C ; date +%H:%M:%S; read -t 1 -s -n 1 C"  

Attachments (0)

Change History (2)

comment:1 Changed 7 years ago by jow

Looks like a problem with SIGALRM. Subsequent alarm(1) calls do not result in a signal.

comment:2 Changed 4 years ago by jow

  • Milestone changed from Backfire 10.03.2 to Chaos Calmer (trunk)

Milestone Backfire 10.03.2 deleted

Add Comment

Modify Ticket

as new .

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.