Overview
| Artifact ID: | ebb782c05cce364f65ce11957b0442d0b7789c3d |
|---|---|
| Ticket: | 2140628fffffffffffffffffffffffffffffffff
[unknown] should leave no tracks |
| User & Date: | ferrieux on 2008-10-16 18:22:00 |
Changes
- icomment:
Don, I think there is a confusion here. While I agree with you that defining a contract for the initial value of errorInfo is uninteresting, a side effect of this report is for us to notice that, within [unknown], the code for saving/restoring errorInfo is ugly. More precisely, that code has the two following behaviors: (1) precond: errorInfo is set; postcond: errorInfo is restored to this value (2) precond: errorInfo is not set; postcond: errorInfo is *set* to the error message internally produced (though caught) when attempting to read it ! (1) is the dominant case, and was also the only case in 8.4 since we never entered [unknown] with errorInfo unset (unless the user typed [unset ::errorInfo] of course) (2) is a more recently exposed case, and is a bug. The fix, by the way, is trivial: --- orig-init.tcl2008-10-16 11:50:31.863767000 +0200 +++ init.tcl2008-10-16 13:20:06.779931000 +0200 @@ -250,9 +250,18 @@ dict incr opts -level return -options $opts $result } - - catch {set savedErrorInfo $::errorInfo} - catch {set savedErrorCode $::errorCode} + if {[info exists ::errorInfo]} { +set savedErrorInfo $::errorInfo +set unsetErrorInfo 0 +} else { +set unsetErrorInfo 1 +} + if {[info exists ::errorCode]} { +set savedErrorCode $::errorCode +set unsetErrorCode 0 +} else { +set unsetErrorCode 1 +} set name $cmd if {![info exists auto_noload]} { # @@ -275,8 +284,8 @@ unset UnknownPending } if {$msg} { - catch {set ::errorCode $savedErrorCode} - catch {set ::errorInfo $savedErrorInfo} + catch {if {$unsetErrorCode} {unset ::errorCode} else {set ::errorCode $savedErrorCode}} + catch {if {$unsetErrorInfo} {unset ::errorInfo} else {set ::errorInfo $savedErrorInfo}} set code [catch {uplevel 1 $args} msg opts] if {$code == 1} { # - login: "ferrieux"
- mimetype: "text/plain"
- status changed to: "Open"
- username: "ferrieux"