-singleproc 1 testing conflict trace-34.7 while-old-4.6
Open21ba1dc8a33d9de280b7f375bbe22e886d1c13f9Created 16 days agoUpdated 6 days ago
Descriptionplain2026-11-16 14:36:46
$ make test-tcl TESTFLAGS='-singleproc 1 -file "trace.test while-old.test" -match "trace-34.7 while-old-4.6"'
...
Tests began at 2026-11-16 09:35:52 EST
trace.test
while-old.test
==== while-old-4.6 errors in while loops FAILED
==== Contents of test case:
set err [catch {while {1} {error "loop aborted"}} msg]
list $err $msg $::errorInfo
---- Result was:
1 {loop aborted} {loop aborted
while executing
"error "loop aborted""
("while" body line 1)
invoked from within
"while {1} {error "loop aborted"}"}
---- Result should have been (exact matching):
1 {loop aborted} {loop aborted
while executing
"error "loop aborted""}
==== while-old-4.6 FAILED
Tests ended at 2026-11-16 09:35:52 EST
Referenced by1
fafe42a47aFix [21ba1dc8a3]: after an execution trace callback deleted the last step trace, commands were no longer compiled inline. TraceExecutionProc() restored the whole iPtr->flags after the callback, which set DONT_COMPILE_CMDS_INLINE again after Tcl_DeleteTrace() had cleared it. Restore only INTERP_TRACE_IN_PROGRESS. This made while-old-4.6 fail after trace-34.7 with -singleproc 1. check-in2026-11-26 16:19:16
dgpplain2026-11-25 17:04:33
The symptoms here are due to an exposure of another bug.
The stack trace generated by an error in a [while] body
is different whether or not [while] was executed as
bytecode or whether it was directly evaluated. See
this demonstration:
% catch {while 1 {error boom}} m o; dict get $o -errorinfo
boom
while executing
"error boom"
% set while while
while
% catch {$while 1 {error boom}} m o; dict get $o -errorinfo
boom
while executing
"error boom"
("while" body line 1)
invoked from within
"$while 1 {error boom}"
This alone is a bug. Everything Is A String rules should
compel the two scripts, which are string equal after substitution,
to produce identical results. Said another way, bytecode
execution is not supposed to produce variant outcomes.
The test while-old-4.6 is explicitly demanding the behavior
that bytecode execution follows.
Something about the new test trace-34.7 is lingering in the
interp a long time over the course of many intervening tests
and causing the [while] command to follow the direct eval path,
which fails the test.
dgpplain2026-11-25 17:12:48
For now, I will be satisfied if we determine what residue the test trace-34.7 is leaving behind in the interp, and make it clean up after itself, so we restore the -singleproc 1 testing mode to a failure-free `make test`. If it helps, it appears the interp changes state and exhibits the failing behavior after the second [foo] command in the test body of trace-34.7. We can then address the longstanding mismatch between error stack generation by bytecoded [while] and direct evaluation of [while] as a separate bug.
serhiy.storchakawiki2026-11-26 16:20:19
The trace leaves the interp unable to compile commands inline: TraceExecutionProc() restores the whole iPtr->flags after the callback, so when the callback deletes the last step trace, the DONT_COMPILE_CMDS_INLINE flag cleared by Tcl_DeleteTrace() is set again. Since at least 8.5. Proposed fix in branch step-trace-inline-flag: restore only INTERP_TRACE_IN_PROGRESS. Test trace-34.8.
Log in (anonymous is fine) to add a comment.