Skip to content
Tcl Source Code View Ticket
Login

View Ticket

-singleproc 1 test interference failure

Closed / Fixedc87f07eb18a4662f5186961106735f7f591bf984Created 3 years agoUpdated 3 years ago
Descriptionplain2023-11-14 19:03:06
$ make test-tcl TESTFLAGS='-file "listObj.test string.test" -singleproc 1 -match "listobj-14.1 string-*"'
...
listObj.test
string.test


==== string-5.1.0 string index FAILED
==== Contents of test case:

    list [catch {run {string index}} msg] $msg

---- Result was:
1 {wrong # args: should be "string {} string charIndex"}
---- Result should have been (exact matching):
1 {wrong # args: should be "string index string charIndex"}
==== string-5.1.0 FAILED



==== string-5.2.0 string index FAILED
==== Contents of test case:

    list [catch {run {string index a b c}} msg] $msg

---- Result was:
1 {wrong # args: should be "string {} string charIndex"}
---- Result should have been (exact matching):
1 {wrong # args: should be "string index string charIndex"}
==== string-5.2.0 FAILED
dgpplain2023-11-20 17:13:23
I think another manifestation of the same problem:

$ make gdb-test TESTFLAGS='-singleproc 1 -file "listObj.test string.test"'
...
Tests began at Mon Nov 20 12:05:07 EST 2023
listObj.test
string.test

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff72448e5 in __strlen_sse2_pminub () from /lib64/libc.so.6
Missing separate debuginfos, use: debuginfo-install glibc-2.17-326.el7_9.x86_64 zlib-1.2.7-21.el7_9.x86_64
(gdb) bt
#0  0x00007ffff72448e5 in __strlen_sse2_pminub () from /lib64/libc.so.6
#1  0x0000000000544939 in Tcl_WrongNumArgs (interp=0x8e9860, objc=0, 
    objv=0xbfc090, message=0x6395a0 "string charIndex")
    at /home/dgp/fossil/tcl9.0b1/generic/tclIndexObj.c:872
#2  0x00000000004609eb in StringIndexCmd (dummy1396=0x0, interp=0x8e9860, 
    objc=1, objv=0xbfc088) at /home/dgp/fossil/tcl9.0b1/generic/tclCmdMZ.c:1404
#3  0x00000000004375be in Dispatch (data=0xfa2ae8, interp=0x8e9860, 
    dummy4558=0) at /home/dgp/fossil/tcl9.0b1/generic/tclBasic.c:4596
#4  0x0000000000437625 in TclNRRunCallbacks (interp=0x8e9860, result=0, 
    rootPtr=0x0) at /home/dgp/fossil/tcl9.0b1/generic/tclBasic.c:4612
#5  0x0000000000436da1 in Tcl_EvalObjv (interp=0x8e9860, objc=3, 
    objv=0x8edbf0, flags=2097168)
    at /home/dgp/fossil/tcl9.0b1/generic/tclBasic.c:4355
#6  0x0000000000439813 in TclEvalEx (interp=0x8e9860, 
    script=0x98d6d0 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests.  Execute it by invoking \"source all.tcl\" when running tcltest\n# in this directory.\n#\n# Copyright © 1998-1999 Scri"..., 
    numBytes=1012, flags=0, line=26, clNextOuter=0x0, 
    outerScript=0x98d6d0 "# all.tcl --\n#\n# This file contains a top-level script to run all of the Tcl\n# tests.  Execute it by invoking \"source all.tcl\" when running tcltest\n# in this directory.\n#\n# Copyright © 1998-1999 Scri"...)
    at /home/dgp/fossil/tcl9.0b1/generic/tclBasic.c:5451
#7  0x000000000056ab46 in Tcl_FSEvalFileEx (interp=0x8e9860, pathPtr=0x941ea0, 
    encodingName=0x643ea9 "utf-8")
    at /home/dgp/fossil/tcl9.0b1/generic/tclIOUtil.c:1784
#8  0x0000000000578466 in Tcl_MainEx (argc=-1, argv=0x7fffffffcd08, 
    appInitProc=0x40f31c <Tcl_AppInit>, interp=0x8e9860)
    at /home/dgp/fossil/tcl9.0b1/generic/tclMain.c:412
#9  0x000000000040f31c in main (argc=8, argv=0x7fffffffcd08)
    at /home/dgp/fossil/tcl9.0b1/unix/tclAppInit.c:94
dgp Ticket [c87f07eb18]: 3 changes [History diff]2023-11-20 17:13:47
dgpplain2023-11-20 19:21:26
Segfault from this minimized demo script:

testobj set 1 [list]
testlistobj index 1 -1
string index

testlistobj does something to the literal value "index"
that later shared use in [string index] is not happy with.
dgpplain2023-11-20 19:49:52
All boils down to a missing flag argument TCL_INDEX_TEMP_TABLE not
passed to Tcl_GetIndexFromObj() when it must be.
jan.nijtmanswiki2023-11-20 20:57:14

I don't think adding TCL_INDEX_TEMP_TABLE is the 'right' solution here: The real problem was a missing 'static' keyword. Added now.

jan.nijtmans Closed ticket [c87f07eb18]. [History diff]2023-11-20 21:57:03
Log in (anonymous is fine) to add a comment.