Tcl 8.5 first use of clock format puts info in errorInfo
Closed / Rejected3358681fffffffffffffffffffffffffffffffffCreated 15 years agoUpdated 15 years ago
Descriptionplain2011-07-08 17:46:44
The first time clock format is called after tclsh is started, it puts information in errorInfo. This causes Tcl programs to fail later once they check errorInfo.
ActiveTcl8.5.10.0.294993-win32-x86_64-threaded
Here's an example,
C:\Users\Administrator>tclsh
% set errorInfo
% clock seconds
1310112414
% set errorInfo
% set a [clock format [clock seconds] ] Fri Jul 08 01:07:19 PDT 2011 % set errorInfo couldn't open "C:/Tcl/lib/tclIndex": no such file or directory
while executing
"open [file join $dir tclIndex]"
%
It can be worked around but it takes a bit of work to track down the issue.
hobbsplain2011-07-09 01:36:05
I'm inclined to close this because it's not really a bug. Lots of things can cause side effects that may set errorInfo, but as long as the command itself reports ok/error appropriately, this shouldn't be an issue. For example, another side effect from clock use on Windows:
(tkcon) 88 % clock format 10
Wed Dec 31 16:00:10 PST 1969
(tkcon) 89 % set errorInfo
key "01009" not known in dictionary
while executing
"dict get $WinRegToISO639 $locale"
but again, I see this as OK because the clock format didn't error.
mellenbeplain2011-07-09 03:38:22
We have been using 8.4 builds for years and have not seen this behavior. The new behavior broke our automation framework. The command worked fine; the message in erroInfo seems a mistake or a one time warning? Only occurs on the first execution and if the command works, what value is it reporting and error? Doc. When a Tcl command or procedure encounters an error during its execution, the global variable errorInfo is set, and an error condition is generated. Ouput from the command is fine but apparently there is a problem somewhere because and error condition is being set. Something does not seem right. Mike
hobbsplain2011-07-09 03:55:45
allow_comments - 1 8.5 clock was rewritten, but it would seem your automation framework is what is brittle. There are many commands that can cause side-effect errorInfo, the point is that is only valid overall when an error is thrown. Commands can do stuff and suppress the final error in order to operate. There is no guarantee of clean error vars in the docs.
Log in (anonymous is fine) to add a comment.