Note: Development of Tcl/Tk is now hosted at SourceForge with public bug, patch, and feature request trackers. I no longer post my patches separately here. They are available at SourceForge.
The following patches to various versions of the Tcl/Tk Core have been submitted to Scriptics Corporation for their consideration to be included in future Tcl/Tk Core releases.
Curious note: The two patches submitted first were only one character long each.
The test script crashes Tcl. The patch corrects the error. The problem is that [trace vdelete] frees a pointer which TraceVarProc() still needs to use later.
The documentation for [namespace code script] states:Captures the current namespace context for later execu- tion of the script script. It returns a new script in which script has been wrapped in a namespace code com- mand. The new script has two important properties. First, it can be evaluated in any namespace and will cause script to be evaluated in the current namespace (the one where the namespace code command was invoked).Although the claim is made for "any namespace", [namespace code] in fact fails to properly wrap a script for evaluation in a namespace where the command [namespace] has been re-defined. The patch fixes that bug.
Several parts of the Tcl script library and its included packages use the [uplevel] command assuming the built-in command names in the caller's context actually refer to the built-in commands.Since the caller can be in a namespace where commands have been redefined, such assumptions should not be made.
The included patch fixes these errors.
The $::errorInfo generated by an error in the evaluation of a command should be the same whether or not that command is being auto-loaded by [unknown]. Evaluation of the test script shows that is not the case.
Documentation says usage is [package forget package], but code allows arbitrary number of arguments.
Test unixInit-3.2 fails when LC_ALL or LC_CTYPE is set.
The scale widget value can ``shake'' between two values when it should hold a constant value.
[auto_execok start] returns an empty string. On Windows NT, it should return "$env(COMSPEC) /c start".
On Compaq Tru64 Unix 5.0, [expr {" "}] returns 0.0. Other platforms return " ".
'make gendate' is supposed to regenerate tclDate.c, but it fails.
Compilation of tclDate.c by gcc generates several warnings like:./../generic/tclDate.c:663: warning: subscript has type `char'
'make gendate' is supposed to regenerate tclDate.c, but it fails.
The scale widget sometimes set its value from uninitialized memory, which sometimes caused a floating point exception.
Evaluation of the following test script by wish1.1b1 dumps core:package require Tk
set t [text .t]
$t insert end \n
$t window create end -window [button $t.b]
$t index end-2c
Whenever an embedded window is at the first position of a line in a text widget (in the test script, at index 2.0), and we try to compute that index using a modifier which starts with "-" (like "-2c"), a bug in the function TkTextIndexBackChars() causes an incorrect index to be computed. The incorrect index refers to one position past the end of the preceding line (in the test script, 1.1) and when later code tries to reference that incorrect index, it attempts to follow a NULL pointer. **CRASH**
There is an extra close bracket in the construction of the name of the penultimate directory on tcl_findLibrary's search path. To expose the bug, rename the file $tk_library/tk.tcl to something else and launch wish8.0. The error is evident in the error message returned by tcl_findLibrary:Application initialization failed: Can't find a usable tk.tcl in the following directories:
/home/fs3c/dgp/lib/tk8.0 /home/fs3c/dgp/sparc/solaris2/lib/tk8.0 /home/fs3c/dgp/sparc/lib/tk8.0 /home/fs3c/dgp/sparc/solaris2/library /home/fs3c/dgp/sparc/library /home/fs3c/dgp/sparc tk8.0 library\] /home/fs3c/dgp/tk8.0/library
When Tk's privates have been concealed, some code which access the privates may break. This patch adds two commands, [::tk::unsupported::ExposePrivateCommand] and [::tk::unsupported::ExposePrivateVariable] to allow those who need access to Tk's privates to support their old scripts to gain that access when using a Tk patched to conceal those privates.
The documentation for [info loaded] says that it returns a list of pairs. The second element in each pair is supposed to be a package name. However, [info loaded] returns the prefix computed for initialization procedures, not the package name. They can be different in case, and package names are case sensitive.
The patch corrects this error, so that real package names are returned by [info loaded]. It also adds a package to the return of [info loaded {}] only if [load] actually provides the package.
When Tcl is patched so that [load] and [info loaded] use real package names, then Tk's test suite breaks where it incorrectly calls [load {} tk]. This patch replaces all of those instances with [load {} Tk].
Moves all private commands and variables into ::tk namespace or its [namespace children].
Modified the package command to accept version numbers like 8.2b3 and provide a [package threshold] command to control whether alpha or beta versions of a package are acceptable for satisfying a [package require] command. Documentation and test suite patches are included. See the patched documentation for [package] and Tcl_PkgSetThreshold() for details.
When the environment variable TCL_LIBRARY is set, I expect the Tcl library to initialize using the scripts indicated by its value. However, if an error occurs during evaluation of the script $TCL_LIBRARY/init.tcl, the Tcl library silently ignores it and proceeds to initialize using another init.tcl in its search path, never reporting the error. Errors are reported only if no usable init.tcl can be found.
This makes it difficult to test an alternative set of initialization scripts. The user is led to believe the alternative scripts are working when they are not. The user has to know to check that [info library] and $env(TCL_LIBRARY) are the same to verify that the alternative scripts are in use. If they are not in use, there was some error, but the error message and stack trace are lost so debugging is complicated.
Enables building on NT/Alpha with MSVC++ 6.0 with just a one-line edit of makefile.vc.
Enables building on NT/Alpha with MSVC++ 6.0 with just a one-line edit of makefile.vc.
When an error occurs in the auto-loading of a command, [unknown] catches and re-raises the error. In the process, all details of the calling stack trace are lost. This can make it difficult to locate the cause of the error when debugging auto-load scripts.
[unknown] also prepends the string "error while autoloading \"$name\": " to the error message. This information says something about the context in which the error was raised, nothing about the error itself. The proper place to record context information about an error is in the global errorInfo variable. When several auto-loads get nested, the prepended strings add up to create a long confusing line before getting to the point : what the error is.
The simple patch provided corrects both problems by preserving $errorInfo when re-raising the error, and appending to errorInfo the contextual information that the error occured while autoloading.
'make runtest' ought to make sure the tktest executable has been built and is up to date with an appropriate make dependency.
This patch was evaluated and rejected by Scriptics with the explanation that the behavior without the dependency is the correct one. However, the corresponding target in Tcl's Makefile includes the dependency, so I don't understand the inconsistency. (What's right for Tcl is wrong for Tk?) I still prefer having the dependency in place.