Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: b02bcab768c543cb06d206b75e5214ecdab046ce3116a6b1254db6b5c89e618f
Ticket: a34733451b2cf189528061944466cf7ce7015008
Regression with TIP #636 in foreach
User & Date: fvogel on 2023-07-09 16:25:18
Changes

  1. comment changed to:
    Github Actions testing Tk trunk on Linux with the main Tcl (9.0) branch [https://github.com/tcltk/tk/actions/runs/5498558004/jobs/10023375244|results in three errors] that were not present before.
    
    <verbatim>
    ==== imgPhoto-4.79 ImgPhotoCmd, transparency get: no option FAILED
    ==== Contents of test case:
    
        set pixelCoords {{156 239} {76 207} {153 213} {139 43} {75 112}}
        foreach coord $pixelCoords {
    	lappend result [photo1 transparency get {*}$coord]
        }
        set result
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: can't read "coord": no such variable
        while executing
    "photo1 transparency get {*}$coord"
        ("foreach" body line 2)
        invoked from within
    "foreach coord $pixelCoords {
    	lappend result [photo1 transparency get {*}$coord]
        }"
        ("uplevel" body line 3)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: TCL LOOKUP VARNAME coord
    ==== imgPhoto-4.79 FAILED
    
    
    ==== imgPhoto-4.81 ImgPhotoCmd, transparency get: -alpha FAILED
    ==== Contents of test case:
    
        set pixelCoords {{156 239} {76 207} {153 213} {139 43} {75 112}}
        foreach coord $pixelCoords {
    	lappend result [photo1 transparency get {*}$coord -alpha]
        }
        set result
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: can't read "coord": no such variable
        while executing
    "photo1 transparency get {*}$coord -alpha"
        ("foreach" body line 2)
        invoked from within
    "foreach coord $pixelCoords {
    	lappend result [photo1 transparency get {*}$coord -alpha]
        }"
        ("uplevel" body line 3)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: TCL LOOKUP VARNAME coord
    ==== imgPhoto-4.81 FAILED
    
    
    ==== panedwindow-17.1 MoveSash, move right FAILED
    ==== Contents of test case:
    
        panedwindow .p -showhandle false -borderwidth 0 -sashpad 0 -sashwidth 2
        foreach w {.f1 .f2} c {red blue} {
            .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew
        }
    
        # Get the requested width of the paned window
        lappend result [winfo reqwidth .p]
    
        .p sash place 0 30 0
    
        # Get the reqwidth again, to make sure it hasn't changed
        lappend result [winfo reqwidth .p]
    
        # Check that the sash moved
        lappend result [.p sash coord 0]
    
    ---- Test generated error; Return code was: 1
    ---- Return code should have been one of: 0 2
    ---- errorInfo: unknown color name "3"
        (processing "-bg" option)
        invoked from within
    "frame $w -height 20 -width 20 -bg $c"
        ("foreach" body line 2)
        invoked from within
    "foreach w {.f1 .f2} c {red blue} {
            .p add [frame $w -height 20 -width 20 -bg $c] -sticky nsew
        }"
        ("uplevel" body line 3)
        invoked from within
    "uplevel 1 $script"
    ---- errorCode: TK LOOKUP COLOR 3
    ==== panedwindow-17.1 FAILED
    
    </verbatim>
    
    plus an additional error message:
    
    <verbatim>
    [...]
    unixWm.test
    Test file error: can't read "geom": no such variable
    util.test
    [...]
    </verbatim>
    
    Bisection shows that the first commit triggering this regression is [91c2f411e7], that is the merge of [https://core.tcl-lang.org/tips/doc/trunk/tip/636.md|TIP #636] implementation into trunk.
    
    In all the four cases, the problem is in a foreach loop apparently not assigning a value to the loop variable.
    
    Warning: the problem cannot be reproduced when running only the imgPhoto.test or panedwindow.test file from Tk. Running the entire test suite of Tk allows however to reproduce (on all three platforms).
    
  2. login: "fvogel"
  3. mimetype: "text/plain"