summaryrefslogtreecommitdiffstats
path: root/tests/unixInit.test
diff options
context:
space:
mode:
authordgp <dgp@users.sourceforge.net>2001-07-03 16:53:32 (GMT)
committerdgp <dgp@users.sourceforge.net>2001-07-03 16:53:32 (GMT)
commit0c014698e77d29ad50f61b887703a34c93778339 (patch)
treebfaf583ff427cb5f6deb2a0fe512015964b25295 /tests/unixInit.test
parenta1b25ad219318a10ce685f69201b2fd94731f74d (diff)
downloadtcl-0c014698e77d29ad50f61b887703a34c93778339.zip
tcl-0c014698e77d29ad50f61b887703a34c93778339.tar.gz
tcl-0c014698e77d29ad50f61b887703a34c93778339.tar.bz2
* tests/unixInit.test (unixInit-2.8): Changed test back to using
installation layout, adding comments explaining why the test writes to the directories it does, and checks to avoid destroying other files in /tmp.
Diffstat (limited to 'tests/unixInit.test')
-rw-r--r--tests/unixInit.test41
1 files changed, 36 insertions, 5 deletions
diff --git a/tests/unixInit.test b/tests/unixInit.test
index d22c0d7..d6c9665 100644
--- a/tests/unixInit.test
+++ b/tests/unixInit.test
@@ -10,7 +10,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: unixInit.test,v 1.18 2001/07/03 10:26:48 dkf Exp $
+# RCS: @(#) $Id: unixInit.test,v 1.19 2001/07/03 16:53:33 dgp Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -202,21 +202,52 @@ test unixInit-2.7 {TclpInitLibraryPath: compiled-in library path} \
# [lindex $auto_path end]
} {}
test unixInit-2.8 {TclpInitLibraryPath: all absolute pathtype} {unixOnly} {
+ # Checking for Bug 219416
+ # When a program that embeds the Tcl library, like tcltest, is
+ # installed near the "root" of the file system, there was a problem
+ # constructing directories relative to the executable. When a
+ # relative ".." went past the root, realtive path names were created
+ # rather than absolute pathnames. In some cases, accessing past the
+ # root caused memory access violations too.
+ #
+ # The bug is now fixed, but here we check for it by making sure that
+ # the directories constructed relative to the executable are all
+ # absolute pathnames, even when the executable is installed near
+ # the root of the filesystem.
+ #
+ # The only directory near the root we are likely to have write access
+ # to is /tmp.
file delete -force /tmp/sparkly
- file delete -force /tmp/library
+ file delete -force /tmp/lib/tcl[info tclversion]
file mkdir /tmp/sparkly
file copy $::tcltest::tcltest /tmp/sparkly/tcltest
- file mkdir /tmp/library/
- close [open /tmp/library/init.tcl w]
+ # Keep any existing /tmp/lib directory
+ set deletelib 1
+ if {[file exists /tmp/lib]} {
+ if {[file isdirectory /tmp/lib]} {
+ set deletelib 0
+ } else {
+ file delete -force /tmp/lib
+ }
+ }
+
+ # For a successful Tcl_Init, we need a [source]-able init.tcl in
+ # ../lib/tcl$version relative to the executable.
+ file mkdir /tmp/lib/tcl[info tclversion]
+ close [open /tmp/lib/tcl[info tclversion]/init.tcl w]
+ # Check that all directories in the library path are absolute pathnames
set allAbsolute 1
foreach dir [getlibpath /tmp/sparkly/tcltest] {
set allAbsolute [expr {$allAbsolute \
&& [string equal absolute [file pathtype $dir]]}]
}
+
+ # Clean up temporary installation
file delete -force /tmp/sparkly
- file delete -force /tmp/library
+ file delete -force /tmp/lib/tcl[info tclversion]
+ if {$deletelib} {file delete -force /tmp/lib}
set allAbsolute
} 1
test unixInit-2.9 {TclpInitLibraryPath: paths relative to executable} {