summaryrefslogtreecommitdiffstats
path: root/library/tm.tcl
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2020-12-06 18:24:00 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2020-12-06 18:24:00 (GMT)
commit0f93742804d047a8de0fe3acda7b019daae7b273 (patch)
tree18bed9fa65dbe84ebb028ca81c52ae123e9b3867 /library/tm.tcl
parent7dd7fe1b6c5348772912a64134334358a39f8211 (diff)
parentfcee72d2c7daddae9dd63e4eb14746b7bd319aa9 (diff)
downloadtcl-0f93742804d047a8de0fe3acda7b019daae7b273.zip
tcl-0f93742804d047a8de0fe3acda7b019daae7b273.tar.gz
tcl-0f93742804d047a8de0fe3acda7b019daae7b273.tar.bz2
merge core-8-branch
Diffstat (limited to 'library/tm.tcl')
-rw-r--r--library/tm.tcl19
1 files changed, 12 insertions, 7 deletions
diff --git a/library/tm.tcl b/library/tm.tcl
index 1802bb9..3c0ec22 100644
--- a/library/tm.tcl
+++ b/library/tm.tcl
@@ -212,11 +212,12 @@ proc ::tcl::tm::UnknownHandler {original name args} {
}
set strip [llength [file split $path]]
- # We can't use glob in safe interps, so enclose the following in a
- # catch statement, where we get the module files out of the
- # subdirectories. In other words, Tcl Modules are not-functional
- # in such an interpreter. This is the same as for the command
- # "tclPkgUnknown", i.e. the search for regular packages.
+ # Get the module files out of the subdirectories.
+ # - Safe Base interpreters have a restricted "glob" command that
+ # works in this case.
+ # - The "catch" was essential when there was no safe glob and every
+ # call in a safe interp failed; it is retained only for corner
+ # cases in which the eventual call to glob returns an error.
catch {
# We always look for _all_ possible modules in the current
@@ -238,12 +239,16 @@ proc ::tcl::tm::UnknownHandler {original name args} {
continue
}
- if {[package ifneeded $pkgname $pkgversion] ne {}} {
+ if {([package ifneeded $pkgname $pkgversion] ne {})
+ && (![interp issafe])
+ } {
# There's already a provide script registered for
# this version of this package. Since all units of
# code claiming to be the same version of the same
# package ought to be identical, just stick with
# the one we already have.
+ # This does not apply to Safe Base interpreters because
+ # the token-to-directory mapping may have changed.
continue
}
@@ -262,7 +267,7 @@ proc ::tcl::tm::UnknownHandler {original name args} {
# of the package file is the last element in the list.
package ifneeded $pkgname $pkgversion \
- "[::list package provide $pkgname $pkgversion];[::list source -encoding utf-8 $file]"
+ "[::list package provide $pkgname $pkgversion];[::list source $file]"
# We abort in this unknown handler only if we got a
# satisfying candidate for the requested package.