summaryrefslogtreecommitdiffstats
path: root/library/safe.tcl
diff options
context:
space:
mode:
authorkjnash <k.j.nash@usa.net>2020-07-16 16:23:55 (GMT)
committerkjnash <k.j.nash@usa.net>2020-07-16 16:23:55 (GMT)
commitba68516ddb2714e2e7ab22dd2d00b8841712af53 (patch)
tree8903fdd97dc9d3406da81a8cd110c7092d2e47dc /library/safe.tcl
parentab138d729bee33a3f0274e72b5cdb0bb2e83c168 (diff)
parent7d6a2292b530eb21168b734c6dcf292c9927ad08 (diff)
downloadtcl-ba68516ddb2714e2e7ab22dd2d00b8841712af53.zip
tcl-ba68516ddb2714e2e7ab22dd2d00b8841712af53.tar.gz
tcl-ba68516ddb2714e2e7ab22dd2d00b8841712af53.tar.bz2
Merge safe-extra-tests-8-7
Diffstat (limited to 'library/safe.tcl')
-rw-r--r--library/safe.tcl19
1 files changed, 15 insertions, 4 deletions
diff --git a/library/safe.tcl b/library/safe.tcl
index 9218380..46f0c64 100644
--- a/library/safe.tcl
+++ b/library/safe.tcl
@@ -473,7 +473,16 @@ proc ::safe::InterpSetConfig {slave access_path staticsok nestedok deletehook au
# 'platform::shell', which translate into
# 'platform/shell-X.tm', i.e arbitrarily deep
# subdirectories.
- lappend morepaths {*}[glob -nocomplain -directory $dir -type d *]
+ 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
+ }
+ }
foreach sub [glob -nocomplain -directory $dir -type d *] {
lappend slave_tm_roots [file normalize $sub] [dict get $slave_tm_roots $dir]
set lenny [string length [dict get $slave_tm_roots $dir]]
@@ -685,9 +694,11 @@ proc ::safe::interpDelete {slave} {
namespace upvar ::safe S$slave state
- # Sub interpreters would be deleted automatically, but if they are managed
- # by the Safe Base we also need to clean up, and this needs to be done
- # independently of the cleanupHook.
+ # When an interpreter is deleted with [interp delete], any sub-interpreters
+ # are deleted automatically, but this leaves behind their data in the Safe
+ # Base. To clean up properly, we call safe::interpDelete recursively on each
+ # Safe Base sub-interpreter, so each one is deleted cleanly and not by
+ # the automatic mechanism built into [interp delete].
foreach sub [interp slaves $slave] {
if {[info exists ::safe::S[list $slave $sub]]} {
::safe::interpDelete [list $slave $sub]