|
2022-08-25
| ||
| 16:53 | • Closed ticket [64f21f0e50]: Infinite loop with nested try plus 8 other chang... artifact: 6b3c2eff29 user: sebres | |
| 15:59 | • New ticket [64f21f0e50]. artifact: 398e83877c user: anonymous | |
Infinite loop with nested try
Closed / Invalid64f21f0e506d6365a1db0e53eafdee47e6a18375Created 4 years agoUpdated 4 years ago
Descriptionplain2022-08-25 15:59:26
Ubuntu Linux:
Start tclsh on command line.
Paste in the following code:
```
try {
no
} on error outcome {
try {
yes
} on error outcome2 {
puts "$outcome $outcome2"
}
}
```
Expected to get two concatenated error messages, get a streaming column of "y"s until the interpreter finally cores out.
Only the value "yes" in the nested try causes the bug. I haven't found any other value that triggers it.
sebresmarkdown2022-08-25 16:53:31
Try to type yes in linux shell (not in tclsh), you'll notice the same picture.
Hereafter use man yes and see:
yes - output a string repeatedly until killed
Tclsh running in interactive mode has a fallback doing exec command ..., if the command is not found in interpreter (this is documented behavior, see the documentation for unknown handler).
To avoid this in tclsh, either start your snippet as script non-interactively (or disable interactive mode or rewrite default unknown in init.tcl) or simply specify your own yes command like:
proc yes args {return -code error "yes is not a command"}
before you'd try your code.
Thus closed as incorrect.
Log in (anonymous is fine) to add a comment.