diff options
author | dgp <dgp@users.sourceforge.net> | 2001-07-03 16:53:32 (GMT) |
---|---|---|
committer | dgp <dgp@users.sourceforge.net> | 2001-07-03 16:53:32 (GMT) |
commit | 0c014698e77d29ad50f61b887703a34c93778339 (patch) | |
tree | bfaf583ff427cb5f6deb2a0fe512015964b25295 | |
parent | a1b25ad219318a10ce685f69201b2fd94731f74d (diff) | |
download | tcl-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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | tests/unixInit.test | 41 |
2 files changed, 43 insertions, 5 deletions
@@ -1,3 +1,10 @@ +2001-07-03 Don Porter <dgp@users.sourceforge.net> + + * 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. + 2001-07-03 Donal K. Fellows <fellowsd@cs.man.ac.uk> * tests/unixInit.test (unixInit-1.2): Fixed faults reported in 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} { |