Red Hat Bugzilla – Bug 804354
TMOUT=1; read; echo $? causes terminal to die
Last modified: 2012-04-09 08:58:33 EDT
Description of problem:
TMOUT=1; read; echo $?
Causes terminal to die every time
TMOUT=1; read; echo $?
TMOUT=1; read; echo $?; sleep 5
Not a bug; read the docs for TMOUT. You probably want to remove the extra ';' before 'read'.
Lets back up for a second.
Anything that causes a terminal to die is a bug by definition. Nothing I do should be able to abend the terminal application. The terminal disappearing is the problem, not the way I managed to get it to happen, quite by accident.
As far as changing the code goes, that shouldn't matter to the Gnome Terminal application. It's the terminal that has the problem, not the read or the TMOUT for the read.
Notice that I provided two ways to cause the failure. The second version waits till the completion of the sleep to fail. So, in my example, the read is already long gone by time the terminal fails. The sleep is the last thing executed, and the failure is delayed by the sleep interval. sleep has no interest in TMOUT.
I re-read man bash and can find nothing of interest concerning TMOUT as far as it being a separate statement or it being, as you suggest, a part of the read.
What in particular am I missing that you see about the placement of TMOUT?
If I had a section of logic that required multiple read statements, and they all needed a TMOUT value, wouldn't it be normal to code the TMOUT once as a separate statement and have numerous read's react to it?
Is it that I coded the TMOUT on the same physical line?
I don't see what it is you're trying to tell me.
TMOUT=1; sets the value of TMOUT for the shell that is running in your terminal.
As explained in the bash documentation, a positive value makes the shell terminate after that number of seconds. With the shell going away, the terminal has no choice but to fold up and go home.
If anything, you may want to complain to the bash authors.
Thanks for the explanation.
When I read man bash, I came away with it still referring to the read and select statements. With your explanation and re reading man bash what you say makes sense. I would never have finally figured out what it really says without your input.