diff options
author | kjnash <k.j.nash@usa.net> | 2020-07-16 12:16:01 (GMT) |
---|---|---|
committer | kjnash <k.j.nash@usa.net> | 2020-07-16 12:16:01 (GMT) |
commit | 4c85e217974f021c2f8d74a0b540d20400b575df (patch) | |
tree | 3f201fb7dd73c33379eb584bc682f83311787401 /library/safe.tcl | |
parent | a757f1e30d79e5794e5b6a1a7d9826dc4ba52970 (diff) | |
parent | 634e9464b53e5010bd9e78e4b5792011c0f53648 (diff) | |
download | tcl-4c85e217974f021c2f8d74a0b540d20400b575df.zip tcl-4c85e217974f021c2f8d74a0b540d20400b575df.tar.gz tcl-4c85e217974f021c2f8d74a0b540d20400b575df.tar.bz2 |
Merge safe-bugfixes-8-6
Diffstat (limited to 'library/safe.tcl')
-rw-r--r-- | library/safe.tcl | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/library/safe.tcl b/library/safe.tcl index e3eabac..abd85b5 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -406,7 +406,16 @@ proc ::safe::InterpSetConfig {slave access_path staticsok nestedok deletehook} { # '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]] @@ -591,6 +600,17 @@ proc ::safe::interpDelete {slave} { namespace upvar ::safe S$slave state + # 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] + } + } + # If the slave has a cleanup hook registered, call it. Check the # existance because we might be called to delete an interp which has # not been registered with us at all @@ -756,11 +776,15 @@ proc ::safe::AliasGlob {slave args} { while {$at < [llength $args]} { switch -glob -- [set opt [lindex $args $at]] { - -nocomplain - -- - -join - -tails { + -nocomplain - -- - -tails { lappend cmd $opt set got($opt) 1 incr at } + -join { + set got($opt) 1 + incr at + } -types - -type { lappend cmd -types [lindex $args [incr at]] incr at |