Attachment "safe.patch" to
ticket [218605ffff]
added by
dgp
2001-04-28 02:33:04.
Index: doc/interp.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/interp.n,v
retrieving revision 1.5
diff -u -r1.5 interp.n
--- doc/interp.n 1999/09/02 16:26:11 1.5
+++ doc/interp.n 2001/04/27 19:28:43
@@ -381,15 +381,15 @@
error eval expr fblocked
fcopy fileevent flush for
foreach format gets global
-history if incr info
-interp join lappend lindex
-linsert list llength lrange
-lreplace lsearch lsort namespace
-package pid proc puts
-read regexp regsub rename
-return scan seek set
-split string subst switch
-tell trace unset update
+if incr info interp
+join lappend lindex linsert
+list llength lrange lreplace
+lsearch lsort namespace package
+pid proc puts read
+regexp regsub rename return
+scan seek set split
+string subst switch tell
+time trace unset update
uplevel upvar variable vwait
while\fR
.DE
@@ -398,12 +398,43 @@
creates a safe interpreter:
.DS
.ta 1.2i 2.4i 3.6i
-\fBcd exec exit fconfigure
-file glob load open
-pwd socket source vwait\fR
+\fBcd encoding exec exit
+fconfigure file glob load
+open pwd socket source\fR
.DE
These commands can be recreated later as Tcl procedures or aliases, or
re-exposed by \fBinterp expose\fR.
+.PP
+The following commands from Tcl's library of support procedures are
+not present in a safe interpreter:
+.DS
+.ta 1.6i 3.2i
+\fBauto_exec_ok auto_import auto_load
+auto_load_index auto_qualify unknown\fR
+.DE
+Note in particular that safe interpreters have no default \fBunknown\fR
+command, so Tcl's default autoloading facilities are not available.
+Autoload access to Tcl's commands that are normally autoloaded:
+.DS
+.ta 2.1i
+\fB
+auto_mkindex auto_mkindex_old
+auto_reset history
+parray pkg_mkIndex
+::pkg::create ::safe::interpAddToAccessPath
+::safe::interpCreate ::safe::interpConfigure
+::safe::interpDelete ::safe::interpFindInAccessPath
+::safe::interpInit ::safe::setLogCmd
+tcl_endOfWord tcl_findLibrary
+tcl_startOfNextWord tcl_startOfPreviousWord
+tcl_wordBreakAfter tcl_wordBreakBefore\fR
+.DE
+can only be provided by explicit definition of an \fBunknown\fR command
+in the safe interpreter. This will involve exposing the \fBsource\fR
+command. This is most easily accomplished by creating the safe interpreter
+with Tcl's \fBSafe\-Tcl\fR mechanism. \fBSafe\-Tcl\fR provides safe
+versions of \fBsource\fB, \fBload\fR, and other Tcl commands needed
+to support autoloading of commands and the loading of packages.
.VE
.PP
In addition, the \fBenv\fR variable is not present in a safe interpreter,
Index: doc/unknown.n
===================================================================
RCS file: /cvsroot/tcl/tcl/doc/unknown.n,v
retrieving revision 1.3
diff -u -r1.3 unknown.n
--- doc/unknown.n 2000/09/07 14:27:52 1.3
+++ doc/unknown.n 2001/04/27 19:28:43
@@ -20,10 +20,11 @@
.SH DESCRIPTION
.PP
This command is invoked by the Tcl interpreter whenever a script
-tries to invoke a command that doesn't exist. The implementation
-of \fBunknown\fR isn't part of the Tcl core; instead, it is a
-library procedure defined by default when Tcl starts up. You
-can override the default \fBunknown\fR to change its functionality.
+tries to invoke a command that doesn't exist. The default implementation
+of \fBunknown\fR is a library procedure defined when Tcl initializes an
+interpreter. You can override the default \fBunknown\fR to change its
+functionality. Note that there is no default implementation of
+\fBunknown\fR in a safe interpreter.
.PP
If the Tcl interpreter encounters a command name for which there
is not a defined command, then Tcl checks for the existence of
@@ -72,7 +73,7 @@
executed.
.SH "SEE ALSO"
-info(n), proc(n)
+info(n), proc(n), interp(n), library(n)
.SH KEYWORDS
error, non-existent command