Itcl - the [incr Tcl] extension

View Ticket
Login
Ticket Hash: abeae90b4c3c1a307a86653cdee22796228d6e2b
Title: itcl::widget basics lead to segfault
Status: Closed Type: Code_Defect
Severity: Critical Priority: Low
Subsystem: Resolution: Fixed
Last Modified: 2015-12-04 14:56:53
Version Found In: 4.0.3 and trunk
User Comments:
dgp added on 2015-07-31 19:34:33:
$ make gdb
...
(gdb) run
...
% package require Itcl 4
4.0.3
% itcl::widget W {}
::W
% W create .w

Program received signal SIGSEGV, Segmentation fault.
0x0000000000570400 in TclPtrSetVar (interp=0x81e6e0, varPtr=0xb49fc0, 
    arrayPtr=0x0, part1Ptr=0xb4f3e0, part2Ptr=0x0, newValuePtr=0xb4e990, 
    flags=512, index=-1) at /home/dgp/fossil/tcl/generic/tclVar.c:1864
1864                TclDecrRefCount(oldValuePtr);       /* Discard old value. */
Missing separate debuginfos, use: debuginfo-install expat-2.1.0-8.el7.x86_64 fontconfig-2.10.95-7.el7.x86_64 freetype-2.4.11-10.el7_1.1.x86_64 glibc-2.17-78.el7.x86_64 libX11-1.6.0-2.1.el7.x86_64 libXScrnSaver-1.2.2-6.1.el7.x86_64 libXau-1.0.8-2.1.el7.x86_64 libXext-1.3.2-2.1.el7.x86_64 libXft-2.3.1-5.1.el7.x86_64 libXrender-0.9.8-2.1.el7.x86_64 libxcb-1.9-5.el7.x86_64 zlib-1.2.7-13.el7.x86_64
(gdb) bt
#0  0x0000000000570400 in TclPtrSetVar (interp=0x81e6e0, varPtr=0xb49fc0, 
    arrayPtr=0x0, part1Ptr=0xb4f3e0, part2Ptr=0x0, newValuePtr=0xb4e990, 
    flags=512, index=-1) at /home/dgp/fossil/tcl/generic/tclVar.c:1864
#1  0x00000000004e8fbe in TEBCresume (data=0xb4f478, interp=0x81e6e0, result=0)
    at /home/dgp/fossil/tcl/generic/tclExecute.c:3573
#2  0x0000000000414c74 in TclNRRunCallbacks (interp=0x81e6e0, result=0, 
    rootPtr=0xb4eae0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4393
#3  0x00000000004143de in Tcl_EvalObjv (interp=0x81e6e0, objc=5, 
    objv=0x9fc950, flags=0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4123
#4  0x00007fffefb6c818 in ItclCreateObject ()
   from /home/dgp/x86_64/linuxoldld/lib/itcl4.0.3/libitcl4.0.3.so
#5  0x0000000000414c74 in TclNRRunCallbacks (interp=0x81e6e0, result=0, 
    rootPtr=0xb4ea20) at /home/dgp/fossil/tcl/generic/tclBasic.c:4393
#6  0x00007fffefb4f0c6 in ItclClassCreateObject ()
   from /home/dgp/x86_64/linuxoldld/lib/itcl4.0.3/libitcl4.0.3.so
#7  0x00007fffefb491df in CallCreateObject ()
   from /home/dgp/x86_64/linuxoldld/lib/itcl4.0.3/libitcl4.0.3.so
#8  0x0000000000414c74 in TclNRRunCallbacks (interp=0x81e6e0, result=0, 
    rootPtr=0xb4ea20) at /home/dgp/fossil/tcl/generic/tclBasic.c:4393
#9  0x00007fffefb486cb in PrepareCreateObject ()
   from /home/dgp/x86_64/linuxoldld/lib/itcl4.0.3/libitcl4.0.3.so
#10 0x00007fffefb48921 in ItclBiClassUnknownCmd ()
   from /home/dgp/x86_64/linuxoldld/lib/itcl4.0.3/libitcl4.0.3.so
#11 0x0000000000414be6 in Dispatch (data=0xb4e938, interp=0x81e6e0, result=0)
    at /home/dgp/fossil/tcl/generic/tclBasic.c:4360
#12 0x0000000000414c74 in TclNRRunCallbacks (interp=0x81e6e0, result=0, 
    rootPtr=0x0) at /home/dgp/fossil/tcl/generic/tclBasic.c:4393
#13 0x000000000041775e in TclEvalObjEx (interp=0x81e6e0, objPtr=0x100000003, 
    flags=131072, invoker=0x0, word=0)
    at /home/dgp/fossil/tcl/generic/tclBasic.c:5959
#14 0x00000000004176f7 in Tcl_EvalObjEx (interp=0x81e6e0, objPtr=0x100000003, 
    flags=131072) at /home/dgp/fossil/tcl/generic/tclBasic.c:5940
#15 0x00000000005bd827 in Tcl_RecordAndEvalObj (interp=0x81e6e0, 
    cmdPtr=0x8646e0, flags=131072)
    at /home/dgp/fossil/tcl/generic/tclHistory.c:190
#16 0x000000000053233a in StdinProc (clientData=0x7fffffffd430, mask=2)
    at /home/dgp/fossil/tcl/generic/tclMain.c:819
#17 0x0000000000517e11 in Tcl_NotifyChannel (channel=0x881110, mask=2)
    at /home/dgp/fossil/tcl/generic/tclIO.c:8315
#18 0x000000000058a28b in FileHandlerEventProc (evPtr=0x9fd290, flags=-3)
    at /home/dgp/fossil/tcl/unix/tclUnixNotfy.c:765
#19 0x0000000000539082 in Tcl_ServiceEvent (flags=-3)
    at /home/dgp/fossil/tcl/generic/tclNotify.c:670
#20 0x00000000005394be in Tcl_DoOneEvent (flags=-3)
    at /home/dgp/fossil/tcl/generic/tclNotify.c:967
#21 0x00007fffef82f9e2 in Tk_MainLoop ()
   from /home/dgp/x86_64/linuxoldld/lib/libtk8.6.so
#22 0x0000000000531ead in Tcl_MainEx (argc=-1, argv=0x7fffffffd630, 
    appInitProc=0x40f236 <Tcl_AppInit>, interp=0x81e6e0)
    at /home/dgp/fossil/tcl/generic/tclMain.c:573
#23 0x000000000040f22f in main (argc=1, argv=0x7fffffffd628)
    at /home/dgp/fossil/tcl/unix/tclAppInit.c:84

dgp added on 2015-08-01 14:54:12:
This segfault is present all the way back to Itcl 4.0b6 (May 2011).

It's not a regression due to recent developments.

Trying to go back further gets into sources that no longer compile
against released Tcl 8.6 (interfaces changed).

itcl::widget is not a command in Itcl 3.  There's no legacy interest
in getting this right.

It appears to be an experiment or work-in-progress that just
never got successfully completed.

Letting it sit at low prio for now.

dgp added on 2015-10-22 16:08:06:
This crash isn't present on the dgp-method-type branch.

dgp added on 2015-12-04 14:56:53:
Error was in Itcl_ClassVarResolver() where a (ItclLookupVar *) got
used as a (Tcl_Var *).