Robustness of init.tcl
Closed / Fixed218564ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:02:21
OriginalBugID: 1138 RFE
Version: 8.0.4
SubmitDate: '1999-02-02'
LastModified: '1999-02-02'
Severity: SER
Status: Released
Submitter: welch
ChangedBy: stanton
OS: Windows 95
OSVersion: 95/98/NT4.0 and Linux (Redhat 4.2)
Machine: X86
FixedDate: '1999-02-02'
FixedInVersion: 8.0.5
ClosedDate: '2000-10-25'
Name:
Jan Nijtmans
DesiredBehavior:
Here are a few small changes to init.tcl, which enhance the
robustness of the Tcl initialization in various practical
situations. These enhancements come from the plus-patches, but are
general enough to be suitable for the core.
- If the variable $tcl_library contains the empty string, this empty
string will be put in $auto_path. This is not useful at all, it only
slows down later package processing.
- If the variable tcl_pkgPath is not set, the "unset __dir" fails. Thich
makes init.tcl totally unusable. Better put a "catch" around it.
- In the function tcl_findLibraries, the "string match" function only
works correctly if $tcl_patchLevel is in one of the forms "?.?a?",
"?.?b?" or "?.?.?". Could a "regexp" be used instead, then it allows
anything to be appended to the patchLevel string. And it is more
efficient.
- The tclPkgSetup function assumes that if $type != "load" then the
type must be "source". This needn't be true. Some users (me, for
example) want to add their own setup types.
Patch:
*** library/init.tcl.origThu Nov 12 06:54:02 1998
--- library/init.tclSat Jan 30 08:59:53 1999
***************
*** 41,51 ****
--- 41,53 ----
set auto_path ""
}
}
+ if {[string compare [info library] {}]} {
foreach __dir [list [info library] [file dirname [info library]]] {
if {[lsearch -exact $auto_path $__dir] < 0} {
lappend auto_path $__dir
}
}
+ }
if {[info exist tcl_pkgPath]} {
foreach __dir $tcl_pkgPath {
if {[lsearch -exact $auto_path $__dir] < 0} {
***************
*** 53,59 ****
}
}
}
! unset __dir
# Windows specific initialization to handle case isses with envars
--- 55,61 ----
}
}
}
! catch {unset __dir}
# Windows specific initialization to handle case isses with envars
***************
*** 610,616 ****
# The C application may have hardwired a path, which we honor
! if {[info exist the_library]} {
lappend dirs $the_library
} else {
--- 612,618 ----
# The C application may have hardwired a path, which we honor
! if {[info exist the_library] && [string compare $the_library {}]} {
lappend dirs $the_library
} else {
***************
*** 640,648 ****
lappend dirs [file join $grandParentDir lib $basename$version]
lappend dirs [file join $parentDir library]
lappend dirs [file join $grandParentDir library]
! if {[string match {*[ab]*} $patch]} {
! set ver $patch
! } else {
set ver $version
}
lappend dirs [file join $grandParentDir $basename$ver library]
--- 642,648 ----
lappend dirs [file join $grandParentDir lib $basename$version]
lappend dirs [file join $parentDir library]
lappend dirs [file join $grandParentDir library]
! if {![regexp {.*[ab][0-9]*} $patch ver]} {
set ver $version
}
lappend dirs [file join $grandParentDir $basename$ver library]
***************
*** 1424,1430 ****
if {$type == "load"} {
set auto_index($cmd) [list load [file join $dir $f] $pkg]
} else {
! set auto_index($cmd) [list source [file join $dir $f]]
}
}
}
--- 1424,1430 ----
if {$type == "load"} {
set auto_index($cmd) [list load [file join $dir $f] $pkg]
} else {
! set auto_index($cmd) [list $type [file join $dir $f]]
}
}
}
PatchFiles:
init.tcl
welch Closed ticket [218564ffff].
[History diff]2000-10-26 08:24:15
dgp Ticket [218564ffff]: 3 changes
[History diff]2001-04-16 23:20:10
Log in (anonymous is fine) to add a comment.