summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2020-07-25 03:12:43 (GMT)
committerkjnash <k.j.nash@usa.net>2020-07-25 03:12:43 (GMT)
commitfb22b961436352a2270921f10182fb493682587d (patch)
treebf4024953000a3b79ca198ab6af094c9de6d89ee
parent4d813970d45f61b8b9a5aad289d668bb844e75cd (diff)
parent17c6c5b754f419272145625b70abd1b3ec039c8e (diff)
downloadtcl-fb22b961436352a2270921f10182fb493682587d.zip
tcl-fb22b961436352a2270921f10182fb493682587d.tar.gz
tcl-fb22b961436352a2270921f10182fb493682587d.tar.bz2
Merge safe-extra-tests-8-7; test safe-19.11 fails.
-rw-r--r--library/safe.tcl41
1 files changed, 13 insertions, 28 deletions
diff --git a/library/safe.tcl b/library/safe.tcl
index 449a7bc..d7b0966 100644
--- a/library/safe.tcl
+++ b/library/safe.tcl
@@ -254,7 +254,7 @@ proc ::safe::interpConfigure {args} {
}
# we can now reconfigure :
set withAutoPath [::tcl::OptProcArgGiven -autoPath]
- set slave_tm_rel [InterpSetConfig $slave $accessPath $statics $nested $deleteHook $autoPath $withAutoPath]
+ InterpSetConfig $slave $accessPath $statics $nested $deleteHook $autoPath $withAutoPath
# auto_reset the slave (to completely synch the new access_path) tests safe-9.8 safe-9.9
if {$doreset} {
@@ -271,19 +271,18 @@ proc ::safe::interpConfigure {args} {
::tcl::tm::add {*}[lreverse $state(tm_path_slave)]]
}
- # Wherever possible, refresh package/module data.
- # - Ideally [package ifneeded $pkg $ver {}] would clear the
- # stale data from the interpreter, but instead it sets a
- # nonsense empty script.
- # - We cannot purge stale package data, but we can overwrite
- # it where we have fresh data. Any remaining stale data will
- # do no harm but the error messages may be cryptic.
- ::interp eval $slave [list catch {package require NOEXIST}]
- foreach rel $slave_tm_rel {
- set cmd [list package require [string map {/ ::} $rel]::NOEXIST]
- ::interp eval $slave [list catch $cmd]
+ # Remove stale "package ifneeded" data for non-loaded packages.
+ # - Not for loaded packages, because "package forget" erases
+ # data from "package provide" as well as "package ifneeded".
+ # - This is OK because the script cannot reload any version of
+ # the package unless it first does "package forget".
+ foreach pkg [::interp eval $slave {package names}] {
+ if {[::interp eval $slave [list package provide $pkg]] eq ""} {
+ ::interp eval $slave [list package forget $pkg]
+ }
}
}
+ return
}
}
}
@@ -410,8 +409,6 @@ proc ::safe::InterpSetConfig {slave access_path staticsok nestedok deletehook au
set map_access_path {}
set remap_access_path {}
set slave_tm_path {}
- set slave_tm_roots {}
- set slave_tm_rel {}
set i 0
foreach dir $access_path {
@@ -452,7 +449,6 @@ proc ::safe::InterpSetConfig {slave access_path staticsok nestedok deletehook au
# Later passes handle subdirectories, which belong in the
# access path but not in the module path.
lappend slave_tm_path [dict get $remap_access_path $dir]
- lappend slave_tm_roots [file normalize $dir] [file normalize $dir]
}
continue
}
@@ -468,7 +464,6 @@ proc ::safe::InterpSetConfig {slave access_path staticsok nestedok deletehook au
# Later passes handle subdirectories, which belong in the
# access path but not in the module path.
lappend slave_tm_path $token
- lappend slave_tm_roots [file normalize $dir] [file normalize $dir]
}
incr i
@@ -478,16 +473,7 @@ proc ::safe::InterpSetConfig {slave access_path staticsok nestedok deletehook au
# 'platform::shell', which translate into
# 'platform/shell-X.tm', i.e arbitrarily deep
# subdirectories.
- set next [glob -nocomplain -directory $dir -type d *]
- lappend morepaths {*}$next
- foreach sub $next {
- lappend slave_tm_roots [file normalize $sub] [dict get $slave_tm_roots $dir]
- set lenny [string length [dict get $slave_tm_roots $dir]]
- set relpath [string range [file normalize $sub] $lenny+1 end]
- if {$relpath ni $slave_tm_rel} {
- lappend slave_tm_rel $relpath
- }
- }
+ lappend morepaths {*}[glob -nocomplain -directory $dir -type d *]
}
set firstpass 0
}
@@ -503,8 +489,7 @@ proc ::safe::InterpSetConfig {slave access_path staticsok nestedok deletehook au
set state(cleanupHook) $deletehook
SyncAccessPath $slave
-
- return $slave_tm_rel
+ return
}