|
2008-10-17
| ||
| 00:01 | • Closed ticket [2140628fff]: unknown should leave no tracks plus 2 other ch... artifact: 5d0f481e4f user: dgp | |
|
2008-10-16
| ||
| 23:28 | • Ticket [2140628fff]: 4 changes artifact: 292ea8969b user: ferrieux | |
| 23:10 | • Open ticket [2140628fff]. artifact: b182f32151 user: mad_derf | |
| 23:09 | • Closed ticket [2140628fff]. artifact: c360395348 user: dgp | |
| 22:58 | • Ticket [2140628fff]: 4 changes artifact: ced9455461 user: ferrieux | |
| 22:36 | • Ticket [2140628fff]: 4 changes artifact: 779a44174e user: dgp | |
| 20:26 | • Ticket [2140628fff]: 2 changes artifact: 71e381a637 user: dgp | |
| 18:22 | • Open ticket [2140628fff]. artifact: ebb782c05c user: ferrieux | |
| 14:02 | • Ticket [2140628fff]: 4 changes artifact: 93d057e682 user: mad_derf | |
| 09:21 | • Closed ticket [2140628fff]. artifact: e3b9af2150 user: sf-robot | |
|
2008-10-02
| ||
| 03:40 | • Ticket [2140628fff]: 1 change artifact: cc97c343ff user: dgp | |
| 03:40 | • Ticket [2140628fff]: 5 changes artifact: 3c1c6d7ed1 user: dgp | |
| 02:43 | • Pending ticket [2140628fff]. artifact: 458ace9317 user: dgp | |
| 02:34 | • Ticket [2140628fff]: 4 changes artifact: 80d5191a84 user: dgp | |
| 02:22 | • Ticket [2140628fff]: 2 changes artifact: aa99a41ca6 user: dgp | |
|
2008-10-01
| ||
| 16:03 | • New ticket [2140628fff]. artifact: 64f7296383 user: mad_derf | |
[unknown] should leave no tracks
Closed / Remind2140628fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-10-01 16:03:31
With the latest Tcl (8.5.4), the errorInfo variable does not seem to be set at tclsh initialisation.
The issue being that, if one does :
set errorInfo
Then we get :
can't read "savedErrorInfo": no such variable
while executing
"set ::errorInfo $savedErrorInfo"
In init.tcl (unknown proc) , there are two ways to fix the issue. Either :
catch {set $::errorInfo} savedErrorInfo
catch {set $::errorCode} savedErrorCode
Which will return :
can't read "::errorInfo": no such variable
When performing the "set errorInfo"
The second solution being :
if {[info exists ::errorInfo]} {
set savedErrorInfo$::errorInfo
} else {
set savedErrorInfo""
}
if {[info exists ::errorInfo]} {
set savedErrorCode$::errorCode
} else {
set savedErrorCode""
}
Which seems to be the cleanest one since it keeps the behaviour of Tcl 8.4
Hope this helps
DERF
dgp Ticket [2140628fff]: 2 changes
[History diff]2008-10-02 02:22:57
dgpplain2008-10-02 02:34:26
Can you describe an actual programming scenario where you want ::errorInfo to have a value before any error has been raised in the interp?
dgpplain2008-10-02 02:43:02
Looking more carefully, it appears things are working correctly. The variable ::errorInfo holds the stack trace from the most recent error, whether it unwound all the way, or whether a [catch] contained it. In an interactive interp like you are testing, the [history] and auto-loading machinery are active, and the stack trace you see is one created when an error is caught within the workings of [unknown].
dgpplain2008-10-02 03:40:34
The init.tcl file in Tcl 8.4 includes the lines: set errorCode "" set errorInfo "" I'm not convinced this is a change that needs "fixing", but if that does end up being desired, the proper fix is just to restore those lines.
dgp Ticket [2140628fff]: 1 change
[History diff]2008-10-02 03:40:50
sf-robotplain2008-10-16 09:21:35
This Tracker item was closed automatically by the system. It was previously set to a Pending status, and the original submitter did not respond within 14 days (the time period specified by the administrator of this Tracker).
mad_derfplain2008-10-16 14:02:31
Well, a simple testcase is to start tclsh and issue 'set errorInfo'. At the very least I would get 'can't read errorInfo : no such variable' ... or, to be backward compatible, have the errorInfo set to nothing. But in no case it should report what it reports, this has nothing to do with getting the value of uninitialised errorInfo ...
ferrieuxplain2008-10-16 18:22:00
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} {
#
dgp Ticket [2140628fff]: 2 changes
[History diff]2008-10-16 20:26:59
dgpplain2008-10-16 22:36:02
1063707 is releated. Reading some commit messages, a key constraint why [unknown] must preserve these global variables is that the old [::bgerror] scheme relies on them as a side channel for passing useful information, and in some situations (notably default Tk) the [::bgerror] command is auto-loaded.
ferrieuxplain2008-10-16 22:58:37
The patch previously sent does preserve these globals, and in addition preserves their "unset" state. Do you have objections against applying it ?
dgpplain2008-10-16 23:09:29
fixed on HEAD and for 8.5.6.
mad_derfplain2008-10-16 23:10:07
*laughing mode on* You're talkin' to me ? *laughing mode off* Well, not sure who the "do *you* have any objections" refers to .. Thanks DERF
ferrieuxplain2008-10-16 23:28:17
Don, while I have to admit your coding style is more elegant than mine, I wonder:
In the committed code you
unset -nocomplain ...
if {...} {set ...}
So this means that in the nominal case you always unset-set in a short sequence.
I'd have rather put the [unset] in the [else]:
if {...} {set ...} else {unset ...}
dgp Closed ticket [2140628fff].
[History diff]2008-10-17 00:01:29
Log in (anonymous is fine) to add a comment.