Bug 804354 - TMOUT=1; read; echo $? causes terminal to die
TMOUT=1; read; echo $? causes terminal to die
Product: Fedora
Classification: Fedora
Component: gnome-terminal (Show other bugs)
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Matthias Clasen
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-03-17 23:51 EDT by Bill Gradwohl
Modified: 2012-04-09 08:58 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-04-09 08:20:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Bill Gradwohl 2012-03-17 23:51:39 EDT
Description of problem:
TMOUT=1; read; echo $?

Causes terminal to die every time

How reproducible:
TMOUT=1; read; echo $?
TMOUT=1; read; echo $?; sleep 5
Comment 1 Christian Persch (GNOME) 2012-04-08 11:05:47 EDT
Not a bug; read the docs for TMOUT. You probably want to remove the extra ';' before 'read'.
Comment 2 Bill Gradwohl 2012-04-08 12:33:45 EDT
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.
Comment 3 Matthias Clasen 2012-04-09 08:20:04 EDT
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.
Comment 4 Bill Gradwohl 2012-04-09 08:58:33 EDT
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.

Thank You

Note You need to log in before you can comment on or make changes to this bug.