Index: client/1.0/neutral/pkgd.eagle ================================================================== --- client/1.0/neutral/pkgd.eagle +++ client/1.0/neutral/pkgd.eagle @@ -1537,28 +1537,73 @@ # identified by the varName argument. The created interpreter has a # fully functioning [package] command ensemble; all other commands do # nothing and return nothing. This procedure may raise script errors. # proc createInterp { varName } { + # + # NOTE: Prepare to provide the caller with the newly created interpreter + # reference. + # upvar 1 $varName interp + # + # NOTE: Create a "safe" interpreter and set the global "dir" variable to + # a single period. Generally, this is the only variable used by a + # package index file. It should be noted that since [set] will be + # a NOP, attempts to use other variables in the specified package + # index file (e.g. ones [set] within it) will fail. + # set interp [interp create -safe] interp eval $interp [list set dir .] + # + # NOTE: First, obtain the list of child namespaces to delete, if any, and + # then delete them all. This should leave the global namespace and + # its commands / variables untouched. + # + set namespaces [interp eval $interp [list namespace children ::]] + + foreach namespace $namespaces { + catch { + interp eval $interp [list namespace delete $namespace] + } + } + + # + # NOTE: Next, obtain the list of global commands and delete all of them + # except the [proc] and [package] commands. The [proc] command is + # handled specially (last) and the [package] command is retained. + # set commands [interp eval $interp [list info commands]] foreach command $commands { if {$command ne "proc" && $command ne "package"} then { interp eval $interp [list proc $command args ""]; # NOP } } if {![isEagle]} then { + # + # HACK: The "safe" interpreters in native Tcl do not contain + # the [file] command at all, not even for [file join] + # and [file split], which may be used in package index + # files; therefore, add it as a NOP command. + # interp eval $interp [list proc file args ""]; # NOP } + # + # NOTE: Next, disable the [proc] command. This must be done last + # because it is used to disable (i.e. via NOP) all the other + # global commands. + # interp eval $interp [list proc proc args ""]; # NOP + + # + # NOTE: Finally, return nothing as the created interpreter reference + # is placed directly into the variable specified by the caller. + # return "" } # # NOTE: This procedure evaluates a script file and attempts to determine the