Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 6da6e09273d6aacdcc54fce80ca56da9190a34b27369ccbc29843c6035be8bb2
Ticket: 9889f96f4da77e3b80dfa7ec6aa99b65c17974d1
Regression when mixing eval + clock + error within condition block
User & Date: xdelaruelle on 2024-05-13 06:47:10
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/x-fossil-plain"
  4. comment changed to:
    Hello,
    
    I have tested 9.0b2rc2 against the testsuite of my project [1] and found 1 regression when mixing code evaluation + clock + error occurring within condition block [2].
    
    Error stack trace does not report the issue at the accurate line in the evaluated code.
    
    I have crafted small scripts that reproduce the issue:
    
    $ cat test.tcl
    set fid [open evaled_script]
    set fdata [read $fid]
    close $fid
    
    eval $fdata
    
    $ cat evaled_script
    set tomorrow [clock format [expr {[clock seconds]+86400}] -format %Y-%m-%d]
    
    if {1} {
        puts
    }
    
    $ /usr/local/tcl9.0b2/bin/tclsh9.0 test.tcl
    wrong # args: should be "puts ?-nonewline? ?channelId? string"
        while executing
    "puts"
        ("eval" body line 2)
        invoked from within
    "eval $fdata"
        (file "test.tcl" line 6)
    
    The stack trace report an issue on line 2 whereas previous versions accurately report it on line 4:
    
    $ tclsh test.tcl
    wrong # args: should be "puts ?-nonewline? ?channelId? string"
        while executing
    "puts"
        ("eval" body line 4)
        invoked from within
    "eval $fdata"
        (file "test.tcl" line 6)
    
    I only see this issue with new version 9.0b2rc2. I have tested against latest versions of 8.6, 8.7 and also 9.0b1: all of these versions produce an accurate stack trace.
    
    Note that if in the reproducer example you either comment the "clock" line or if the erroneous "puts" command is called outside of an if condition block, the produced stack trace is accurate.
    
    I have tried to bisect git repository to find the commit that introduces this regression, but I am not used to bisect repository with numerous merges. What I found is that everything is good up to "a66e28b11e118b2da333da9e5544a300cba41502". The regression seems to be introduced within the "clock" commits that are after.
    
    Regards,
    Xavier
    
    [1] https://github.com/cea-hpc/modules
    [2] https://github.com/xdelaruelle/modules/actions/runs/9052527677/job/24870294288
    
  5. foundin changed to: "9.0b2rc2"
  6. is_private changed to: "0"
  7. login: "xdelaruelle"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "231d7ecff918d0384f1ee469cf171339e824104a"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "xdelaruelle"
  14. subsystem changed to: "06. Time Measurement"
  15. title changed to:
    Regression when mixing eval + clock + error within condition block
    
  16. type changed to: "Bug"