Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6b3c2eff2978178e3d5fae2100e6ef1a3daeb454b88ecb187b9455fb8daf741c
Ticket: 64f21f0e506d6365a1db0e53eafdee47e6a18375
Infinite loop with nested try
User & Date: sebres on 2022-08-25 16:53:31
Changes

  1. closedate changed to: "2459817.2038317"
  2. closer changed to: "sebres"
  3. comment changed to:
    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.
    
  4. icomment:
    Try to type `yes` in linux shell (not in tclsh), you'll notice the same picture.<br/>
    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](https://www.tcl-lang.org/man/tcl/TclCmd/unknown.htm) handler).<br/>
    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.
    
  5. login: "sebres"
  6. mimetype: "text/x-markdown"
  7. resolution changed to: "Invalid"
  8. severity changed to: "Cosmetic"
  9. status changed to: "Closed"