Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 304ff36a6012fe81df3ef4d7548095d7e0791beb
Ticket: 268b23df11916a9da17742ce2595d0634f5a0960
expr Crashes When Traced
User & Date: tomkiti on 2015-06-01 17:23:43
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    The "expr" command crashes tclsh when it is being traced while evaluating a built-in function with a command argument. This can be reproduced with the following script:
    
        proc zero {} {
            return 0
        }
        
        proc crash {} {
            expr {abs([zero])} ;# <=== Crashes
        }
        
        proc traceProc {args} {
        }
        
        trace add execution crash enterstep traceProc
        
        crash
    
    Some observations:
    
        - The "leavestep" trace also crashes, but "enter" and "leave" do not.
        - All "expr" functions seem to crash, not just "abs".
        - For the crash to occur, the argument to the function must be a command, e.g. "[zero]". Passing "0", "[return 0]", or a variable will not crash.
        - Removing the braces will prevent the crash.
        - Removing the trace will prevent the crash.
    
    The workaround is to set the command's result to a variable first and then pass the variable to the "abs" function.
    
  5. foundin changed to: "8.6.4"
  6. is_private changed to: "0"
  7. login: "tomkiti"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "1c57e67924247fd7926e89348f266c081ec57db2"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "tomkiti"
  14. subsystem changed to: "16. Commands A-H"
  15. title changed to: "expr Crashes When Traced"
  16. type changed to: "Bug"