Artifacts Associated With Ticket 760947ffffffffff
Ticket change [48330313ae] (rid 99841) by yahalom on 2003-06-26 04:02:58:
- assignee initialized to: "dkf"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Tcl Version 8.4.3 OS Platform and Version: windows 2000,linux redhat 7.3 when putting a trace on command execution leave the errorInfo and errorCode are not being set properly when an error happens in the command being called proc traceLog {cmd info {result ""} {op ""}} { puts "----- trace -----" puts "command: $cmd" puts "info: $info" puts "result: $result" puts "op: $op" puts "----- leave trace -----" } proc test {} { error "testMsg" "testInfo" "testCode" } for {set i 0} {$i<2} {incr i} { catch {test} msg puts "message: $msg" puts "errorInfo: $errorInfo" puts "errorCode: $errorCode" unset msg unset errorCode unset errorInfo trace add execution test leave {traceLog} } result: message: testMsg errorInfo: testInfo (procedure "test" invoked from with "test" errorCode: testCode ----- trace ----- command: test info: 1 result: testMsg op: leave ----- leave trace --- message: testMsg errorInfo: testMsg while executing "test" errorCode: NONE - foundin initialized to: "obsolete: 8.4.3"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "yahalom"
- subsystem initialized to: "18. Commands M-Z"
- title initialized to: "trace on command leave changes errorInfo/errorCode"
- type initialized to: "Bug"
Ticket change [93a129ca25] (rid 105849) by dkf on 2003-06-26 17:24:07:
- subsystem changed to: "46. Traces"
Ticket change [1201eb7c69] (rid 95243) by dgp on 2003-06-26 22:46:50:
- assignee changed to: "dgp"
Ticket change [0b57bced23] (rid 113967) by dgp on 2003-07-16 19:58:26:
- priority changed to: "9 Immediate"
Ticket change [0765241875] (rid 89391) by dgp on 2003-07-18 02:53:35:
- assignee changed to: "vincentdarley"
- icomment:
Logged In: YES user_id=80530 Can I get another TIP 62 ruling? Is this intended behavior?
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
Ticket change [a804666681] (rid 98904) by vincentdarley on 2003-07-18 17:33:15:
- icomment:
Logged In: YES user_id=32170 Well, the manpage states (for 'leave' and 'leavestep' traces): "If an error occurs while executing the command body, then the command name as a whole will return that same error." The result above does look a little peculiar, although I don't really know enough about error(Code|Info) to be sure what the correct result should be. In some sense if there's a leave trace on 'foo', then the result ought to be nearly identical to that obtained by manually replacing every occurrence of 'foo' in one's code by 'foo ; tracecmd foo ...'. (Obviously this is complicated by additional arguments, and by the cases where foo throws an error itself).
- login: "vincentdarley"
- mimetype: "text/plain"
- username: "vincentdarley"
- icomment:
Ticket change [8d08c91d6f] (rid 127851) by dgp on 2003-07-18 21:55:22:
- assignee changed to: "dgp"
- priority changed to: "8"
Ticket change [b4991d8215] (rid 125068) by dgp on 2003-10-09 00:12:01:
- icomment:
Logged In: YES user_id=80530 re-reading this, it seems that comment in the docs makes either no sense, or only tautological sense. In context "command" refers to the handler command, not the traced command. The name of the traced command is known as "name" in context. Ahhh... hold on. TIP 62 has the correct specification. This is a typo in the man page.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [02d56c6e16] (rid 119717) by dgp on 2003-10-09 00:55:30:
- icomment:
Logged In: YES user_id=80530 updated the docs to be the same as TIP 62. Unfortunately, the documented behavior isn't completely possible, and isn't directly "on point" for this report. It's not possible, because multiple execution traces may be set on a single command, and if more that one trace raises an error, it's not possible for all of those error to become the error of the traced command. Generally error management during execution tracing is way under-specified. The issue in this report deals with a simpler situation, where the traces themselves raise no errors, but corrupt the extra error information produced by the traced command.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [dd7971b887] (rid 114676) by dgp on 2003-10-09 03:37:06:
- icomment:
Logged In: YES user_id=80530 seems the way to fix this is to save and restore the values of ::errorCode and ::errorInfo around the calling of leave traces. potential problem is that this will also cause any read and write traces on those variables to fire. Seems it's not a safe enough change to explore in time for 8.4.5. May need more detailed sorting out and testing through 8.5a development.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "5 Medium"
- username: "dgp"
- icomment:
Ticket change [17c8a9dc1f] (rid 122555) by dgp on 2003-10-09 03:58:33:
- icomment:
Logged In: YES user_id=80530 seems it's even worse that that. While execution traces are handled completely within TclEvalObjvInternal(), the management of errorCode and errorInfo is all over the place, so simple attempt to fix this do not even work. The real culprit may be the Tcl_ResetResult() embedded inside the execution of the leave traces, which cause the errorInfo and errorCode machinery to get reset, upsetting the expectations of the [error] command, which wants Tcl_LogCommandInfo to respect the ERR_ALREADY_LOGGED and ERROR_CODE_SET flags that it set.
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [2e9ad14327] (rid 92922) by dgp on 2003-10-09 05:03:42:
- assignee changed to: "msofer"
- icomment:
File Added - 63814: 760947.patch Logged In: YES user_id=80530 Ha! Yes, that's it. Just needed to get the flags right. Here's a patch that makes the demo script act as expected, and I think it does no damage. Passing to another maintainer for a second opinion.
- login: "dgp"
- mimetype: "text/plain"
- priority changed to: "8"
- username: "dgp"
Ticket change [202cfd2e1b] (rid 91270) by msofer on 2003-10-09 05:46:19:
- assignee changed to: "dgp"
- icomment:
Logged In: YES user_id=148712 Second opinion: I'm pretty sure it does no damage, but I do not claim to really grok traces . Testsuite seems happy too ...
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
Ticket change [d9b8e08eb0] (rid 107656) by dgp on 2003-10-09 06:06:10:
- icomment:
File Added - 63817: 760947.patch Logged In: YES user_id=80530 Revised patch takes more care to only save/restore the bits that control error information. That should ease any safety concerns (deleted or safe interps getting modified, etc...)
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "760947.patch" [88ba2c3d57] (rid 131910) by dgp on 2003-10-09 06:06:10.
Ticket change [2fc382d7ce] (rid 93129) by dgp on 2003-10-09 06:06:11:
- icomment:
File Deleted - 63814:
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Ticket change [be62acad3b] (rid 102063) by dgp on 2003-10-09 06:11:18:
- icomment:
File Added - 63818: 760947-HEAD.patch Logged In: YES user_id=80530 Corresponding patch for the HEAD must also save/restore return options (TIP 90).
- login: "dgp"
- mimetype: "text/plain"
- username: "dgp"
- icomment:
Add attachment "760947-HEAD.patch" [90a73d8fb6] (rid 120489) by dgp on 2003-10-09 06:11:18.
Ticket change [e926b68062] (rid 104764) by dgp on 2003-10-09 06:18:42:
- closedate changed to: "2003-10-08T23:18:42"
- closer changed to: "dgp"
- icomment:
Logged In: YES user_id=80530 Fixed for 8.4.5+.
- login: "dgp"
- mimetype: "text/plain"
- resolution changed to: "Fixed"
- status changed to: "Closed"
- username: "dgp"