Tcl Source Code

View Ticket
Login
Ticket UUID: 3601784
Title: checkin 8e20d1a93f breaks Tk
Type: Bug Created on: 2013-01-22 17:15:11
Submitter: dgp Assigned to: dgp
Subsystem: 47. Bytecode Compiler Severity:
Priority: 8 Last modified: 2013-02-06 03:57:55
Status: Closed Closed by: dgp
Resolution: Fixed Closed on: 2013-02-05 17:45:25
Version: current: 8.6.0
Description:
Starting with the Tcl trunk checkin

    http://core.tcl.tk/tcl/info/8e20d1a93f

The Tk test suite starts failing tests.
Representative test is bitmap-4.1:

==== bitmap-4.1 FreeBitmapObjProc FAILED
==== Contents of test case:

    set x [format questhead]
    button .b -bitmap $x
    set y [format questhead]
    .b configure -bitmap $y
    set z [format questhead]
    .b configure -bitmap $z
    set result {}
    lappend result [testbitmap questhead]
    set x red
    lappend result [testbitmap questhead]
    set z 32
    lappend result [testbitmap questhead]
    destroy .b
    lappend result [testbitmap questhead]
    set y bogus
    return $result

---- Result was:
{{1 1}} {{1 1}} {{1 1}} {}
---- Result should have been (exact matching):
{{1 3}} {{1 2}} {{1 1}} {}
==== bitmap-4.1 FAILED

Do the testing with Tk 8.6.0 sources.  Tk trunk
no longer permits it. See Tk Bug 3601782
User Comments:
dgp added on 2013-01-23 00:22:25:
Looking in more detail, this may really be
a Tk bug in the sense of a fragile testing command.

The changed values are objRefCount fields
counting how many Tcl_Obj structs hold a
(TkBitmap *) to the struct.  These values
might easily change with different shimmer
and share patterns arising from changes to
Tcl that do not indicate any actual failure to
function correctly.

dgp added on 2013-01-23 00:28:14:
Other tests that appear to suffer the
same issue are border-3.1, cursor-4.1,
font-18.1.

dgp added on 2013-02-06 00:18:26:
The new bytecompiled [format] is the trigger,
changing the pattern of sharing literals.

dgp added on 2013-02-06 00:44:43:
Rethinking this throroughly is outside my
arena.  More modestly I notice that
replacing [format] with [join] makes things
behave again.

dgp added on 2013-02-06 00:45:24:
Fixed on Tk trunk.

dgp added on 2013-02-06 00:45:25:

allow_comments - 1

dkf added on 2013-02-06 03:57:55:
Oh I see; the tests really wanted unshared objects and I modified [format] so that (among other things) [format %s $foo] is equivalent to $foo. Which is true, except for code that's testing reference counts and stuff like that.

Something like [string reverse] twice would un-reference the value while preserving the character sequence.