summaryrefslogtreecommitdiff
path: root/systems/texlive/tlnet/tlpkg/tltcl/lib/tcl8.6/init.tcl
diff options
context:
space:
mode:
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tltcl/lib/tcl8.6/init.tcl')
-rw-r--r--systems/texlive/tlnet/tlpkg/tltcl/lib/tcl8.6/init.tcl58
1 files changed, 32 insertions, 26 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tltcl/lib/tcl8.6/init.tcl b/systems/texlive/tlnet/tlpkg/tltcl/lib/tcl8.6/init.tcl
index 5cda0d9574..1bfca4c6da 100644
--- a/systems/texlive/tlnet/tlpkg/tltcl/lib/tcl8.6/init.tcl
+++ b/systems/texlive/tlnet/tlpkg/tltcl/lib/tcl8.6/init.tcl
@@ -6,7 +6,7 @@
# Copyright (c) 1991-1993 The Regents of the University of California.
# Copyright (c) 1994-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-1999 Scriptics Corporation.
-# Copyright (c) 2004 by Kevin B. Kenny. All rights reserved.
+# Copyright (c) 2004 Kevin B. Kenny. All rights reserved.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
@@ -16,7 +16,7 @@
if {[info commands package] == ""} {
error "version mismatch: library\nscripts expect Tcl version 7.5b1 or later but the loaded version is\nonly [info patchlevel]"
}
-package require -exact Tcl 8.6.10
+package require -exact Tcl 8.6.11
# Compute the auto path to use in this interpreter.
# The values on the path come from several locations:
@@ -37,41 +37,46 @@ package require -exact Tcl 8.6.10
# 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
- }
- 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
}
# TIP #255 min and max functions
@@ -79,7 +84,7 @@ namespace eval tcl {
proc min {args} {
if {![llength $args]} {
return -code error \
- "too few arguments to math function \"min\""
+ "not enough arguments to math function \"min\""
}
set val Inf
foreach arg $args {
@@ -95,7 +100,7 @@ namespace eval tcl {
proc max {args} {
if {![llength $args]} {
return -code error \
- "too few arguments to math function \"max\""
+ "not enough arguments to math function \"max\""
}
set val -Inf
foreach arg $args {
@@ -308,7 +313,7 @@ proc unknown args {
set errInfo [string range $errInfo 0 $last-1]
set tail "\"$cinfo\""
set last [string last $tail $errInfo]
- if {$last + [string length $tail] != [string length $errInfo]} {
+ if {$last < 0 || $last + [string length $tail] != [string length $errInfo]} {
return -code error -errorcode $errCode \
-errorinfo $errInfo $msg
}
@@ -489,6 +494,7 @@ proc auto_load_index {} {
continue
} else {
set error [catch {
+ fconfigure $f -eofchar \032
set id [gets $f]
if {$id eq "# Tcl autoload index file, version 2.0"} {
eval [read $f]
@@ -792,7 +798,7 @@ proc tcl::CopyDirectory {action src dest} {
}
}
} else {
- if {[string first $nsrc $ndest] != -1} {
+ if {[string first $nsrc $ndest] >= 0} {
set srclen [expr {[llength [file split $nsrc]] - 1}]
set ndest [lindex [file split $ndest] $srclen]
if {$ndest eq [file tail $nsrc]} {