summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2020-06-24 16:23:53 (GMT)
committersebres <sebres@users.sourceforge.net>2020-06-24 16:23:53 (GMT)
commita4d1a762c2132e20f6746d755693c288c336d313 (patch)
treeff30a60b61e38ebf29091d815ebbbc0e866aa654 /library
parentca6983f6f2222b1cc477798c5f9fee153aafc976 (diff)
parentdbab2685a152edb53d27b36096f264e30a6c051e (diff)
downloadtcl-a4d1a762c2132e20f6746d755693c288c336d313.zip
tcl-a4d1a762c2132e20f6746d755693c288c336d313.tar.gz
tcl-a4d1a762c2132e20f6746d755693c288c336d313.tar.bz2
merge 8.7
Diffstat (limited to 'library')
-rw-r--r--library/init.tcl45
1 files changed, 25 insertions, 20 deletions
diff --git a/library/init.tcl b/library/init.tcl
index e7c2f71..3b3563f 100644
--- a/library/init.tcl
+++ b/library/init.tcl
@@ -40,41 +40,46 @@ package require -exact Tcl 9.0a2
# tcl_pkgPath, which is set by the platform-specific initialization routines
# On UNIX it is compiled in
# On Windows, it is not used
+#
+# (Ticket 41c9857bdd) In a safe interpreter, this file does not set
+# ::auto_path (other than to {} if it is undefined). The caller, typically
+# a Safe Base command, is responsible for setting ::auto_path.
if {![info exists auto_path]} {
- if {[info exists env(TCLLIBPATH)]} {
+ if {[info exists env(TCLLIBPATH)] && (![interp issafe])} {
set auto_path $env(TCLLIBPATH)
} else {
set auto_path ""
}
}
namespace eval tcl {
- variable Dir
- foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
- if {$Dir ni $::auto_path} {
- lappend ::auto_path $Dir
- }
- }
- set Dir [file join [file dirname [file dirname \
- [info nameofexecutable]]] lib]
- if {$Dir ni $::auto_path} {
- lappend ::auto_path $Dir
- }
- if {[info exists ::tcl_pkgPath]} { catch {
- foreach Dir $::tcl_pkgPath {
+ if {![interp issafe]} {
+ variable Dir
+ foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
if {$Dir ni $::auto_path} {
lappend ::auto_path $Dir
}
}
- }}
+ set Dir [file join [file dirname [file dirname \
+ [info nameofexecutable]]] lib]
+ if {$Dir ni $::auto_path} {
+ lappend ::auto_path $Dir
+ }
+ if {[info exists ::tcl_pkgPath]} { catch {
+ foreach Dir $::tcl_pkgPath {
+ if {$Dir ni $::auto_path} {
+ lappend ::auto_path $Dir
+ }
+ }
+ }}
- if {![interp issafe]} {
- variable Path [encoding dirs]
- set Dir [file join $::tcl_library encoding]
- if {$Dir ni $Path} {
+ variable Path [encoding dirs]
+ set Dir [file join $::tcl_library encoding]
+ if {$Dir ni $Path} {
lappend Path $Dir
encoding dirs $Path
- }
+ }
+ unset Dir Path
}
}