Index: ChangeLog
===================================================================
RCS file: /cvsroot/tcl/tcl/ChangeLog,v
retrieving revision 1.1100
diff -u -r1.1100 ChangeLog
--- ChangeLog	4 Jul 2002 15:46:55 -0000	1.1100
+++ ChangeLog	4 Jul 2002 19:59:06 -0000
@@ -1,3 +1,10 @@
+2002-07-04  Andreas Kupries  <andreask@pliers.activestate.com>
+
+	* tests/winPipe.test: 
+
+	* tests/pid.test: Fixed SF Bug #575848. See below for a
+	description the general problem.
+
 2002-07-04  Andreas Kupries  <andreas_kupries@users.sourceforge.net>
 
 	* All the bugs below are instances of the same problem: The
Index: tests/pid.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/pid.test,v
retrieving revision 1.6
diff -u -r1.6 pid.test
--- tests/pid.test	10 Apr 2000 17:19:03 -0000	1.6
+++ tests/pid.test	4 Jul 2002 19:59:07 -0000
@@ -27,12 +27,13 @@
 }
 
 catch {removeFile test1}
+set path(test1) [makeFile {} test1]
 
 test pid-1.1 {pid command} {
     regexp {(^[0-9]+$)|(^0x[0-9a-fA-F]+$)} [pid]
 } 1
 test pid-1.2 {pid command} {unixOrPc unixExecs} {
-    set f [open {| echo foo | cat >test1} w]
+    set f [open [format {| echo foo | cat >%s} $path(test1)] w]
     set pids [pid $f]
     close $f
     catch {removeFile test1}
@@ -41,7 +42,7 @@
        [expr {[lindex $pids 0] == [lindex $pids 1]}]
 } {2 1 1 0}
 test pid-1.3 {pid command} {
-    set f [open test1 w]
+    set f [open $path(test1) w]
     set pids [pid $f]
     close $f
     set pids
Index: tests/socket.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/socket.test,v
retrieving revision 1.23
diff -u -r1.23 socket.test
--- tests/socket.test	15 Apr 2002 23:09:12 -0000	1.23
+++ tests/socket.test	4 Jul 2002 19:59:07 -0000
@@ -248,9 +248,11 @@
     list [catch {socket foo badport} msg] $msg
 } {1 {expected integer but got "badport"}}
 
+set path(script) [makeFile {} script]
+
 test socket-2.1 {tcp connection} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set timer [after 10000 "set x timed_out"]
 	set f [socket -server accept 0]
@@ -267,7 +269,7 @@
 	puts $x
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f x
     gets $f listen
     if {[catch {socket 127.0.0.1 $listen} msg]} {
@@ -288,7 +290,7 @@
 }
 test socket-2.2 {tcp connection with client port specified} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set timer [after 10000 "set x timeout"]
         set f [socket -server accept 0]
@@ -305,7 +307,7 @@
 	close $f
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f x
     gets $f listen
     global port
@@ -324,7 +326,7 @@
 } [list ready "hello $port"]
 test socket-2.3 {tcp connection with client interface specified} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set timer [after 2000 "set x done"]
         set f [socket  -server accept 2830]
@@ -340,7 +342,7 @@
 	close $f
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f x
     if {[catch {socket -myaddr 127.0.0.1 127.0.0.1 2830} sock]} {
         set x $sock
@@ -355,7 +357,7 @@
 } {ready {hello 127.0.0.1}}
 test socket-2.4 {tcp connection with server interface specified} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set timer [after 2000 "set x done"]
         set f [socket -server accept -myaddr [info hostname] 0]
@@ -372,7 +374,7 @@
 	close $f
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f x
     gets $f listen
     if {[catch {socket [info hostname] $listen} sock]} {
@@ -388,7 +390,7 @@
 } {ready hello}
 test socket-2.5 {tcp connection with redundant server port} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set timer [after 10000 "set x timeout"]
         set f [socket -server accept 0]
@@ -405,7 +407,7 @@
 	close $f
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f x
     gets $f listen
     if {[catch {socket 127.0.0.1 $listen} sock]} {
@@ -431,7 +433,7 @@
 } ok
 test socket-2.7 {echo server, one line} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set timer [after 10000 "set x timeout"]
 	set f [socket -server accept 0]
@@ -457,7 +459,7 @@
 	puts $x
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f
     gets $f listen
     set s [socket 127.0.0.1 $listen]
@@ -498,7 +500,7 @@
 	close $f
 	puts "done $i"
     } script
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f
     gets $f listen
     set s [socket 127.0.0.1 $listen]
@@ -517,10 +519,10 @@
 test socket-2.9 {socket conflict} {socket stdio} {
     set s [socket -server accept 0]
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts -nonewline $f "socket -server accept [lindex [fconfigure $s -sockname] 2]"
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f
     after 100
     set x [list [catch {close $f} msg]]
@@ -583,7 +585,7 @@
 
 test socket-3.1 {socket conflict} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set f [socket -server accept 0]
 	puts ready
@@ -592,7 +594,7 @@
 	close $f
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r+]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r+]
     gets $f
     gets $f listen
     set x [list [catch {socket -server accept $listen} msg] \
@@ -603,7 +605,7 @@
 } {1 {couldn't open socket: address already in use}}
 test socket-3.2 {server with several clients} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set t1 [after 30000 "set x timed_out"]
 	set t2 [after 31000 "set x timed_out"]
@@ -636,7 +638,7 @@
 	puts $x
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r+]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r+]
     set x [gets $f]
     gets $f listen
     set s1 [socket 127.0.0.1 $listen]
@@ -663,7 +665,7 @@
 
 test socket-4.1 {server with several clients} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set port [gets stdin]
 	set s [socket 127.0.0.1 $port]
@@ -677,11 +679,11 @@
 	gets stdin
     }
     close $f
-    set p1 [open "|[list $::tcltest::tcltest script]" r+]
+    set p1 [open "|[list $::tcltest::tcltest $path(script)]" r+]
     fconfigure $p1 -buffering line
-    set p2 [open "|[list $::tcltest::tcltest script]" r+]
+    set p2 [open "|[list $::tcltest::tcltest $path(script)]" r+]
     fconfigure $p2 -buffering line
-    set p3 [open "|[list $::tcltest::tcltest script]" r+]
+    set p3 [open "|[list $::tcltest::tcltest $path(script)]" r+]
     fconfigure $p3 -buffering line
     proc accept {s a p} {
 	fconfigure $s -buffering line
@@ -763,13 +765,13 @@
 
 test socket-6.1 {accept callback error} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	gets stdin port
 	socket 127.0.0.1 $port
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r+]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r+]
     proc bgerror args {
 	global x
 	set x $args
@@ -788,7 +790,7 @@
 
 test socket-7.1 {testing socket specific options} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set ss [socket -server accept 0]
 	proc accept args {
@@ -802,7 +804,7 @@
 	after cancel $timer
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f
     gets $f listen
     set s [socket 127.0.0.1 $listen]
@@ -816,7 +818,7 @@
 } {0 0 3}
 test socket-7.2 {testing socket specific options} {socket stdio} {
     removeFile script
-    set f [open script w]
+    set f [open $path(script) w]
     puts $f {
 	set ss [socket -server accept 2821]
 	proc accept args {
@@ -830,7 +832,7 @@
 	after cancel $timer
     }
     close $f
-    set f [open "|[list $::tcltest::tcltest script]" r]
+    set f [open "|[list $::tcltest::tcltest $path(script)]" r]
     gets $f
     gets $f listen
     set s [socket 127.0.0.1 $listen]
@@ -1390,6 +1392,9 @@
     set count
 } 65566
 
+set path(script1) [makeFile {} script1]
+set path(script2) [makeFile {} script2]
+
 test socket-12.1 {testing inheritance of server sockets} {socket exec} {
     removeFile script1
     removeFile script2
@@ -1397,7 +1402,7 @@
     # Script1 is just a 10 second delay.  If the server socket
     # is inherited, it will be held open for 10 seconds
 
-    set f [open script1 w]
+    set f [open $path(script1) w]
     puts $f {
 	after 10000 exit
 	vwait forever
@@ -1408,25 +1413,25 @@
     # waits a second, and exits.  The server socket will now
     # be closed unless script1 inherited it.
 
-    set f [open script2 w]
+    set f [open $path(script2) w]
     puts $f [list set tcltest $::tcltest::tcltest]
-    puts $f {
+    puts $f [format {
 	set f [socket -server accept 0]
 	puts [lindex [fconfigure $f -sockname] 2]
 	proc accept { file addr port } {
 	    close $file
 	}
-	exec $tcltest script1 &
+	exec $tcltest "%s" &
 	close $f
 	after 1000 exit
 	vwait forever
-    }
+    } $path(script1)]
     close $f
 	
     # Launch script2 and wait 5 seconds
 
     ### exec $::tcltest::tcltest script2 &
-    set p [open "|[list $::tcltest::tcltest script2]" r]
+    set p [open "|[list $::tcltest::tcltest $path(script2)]" r]
     gets $p listen
 
     after 5000 { set ok_to_proceed 1 }
@@ -1453,7 +1458,7 @@
     # Script1 is just a 20 second delay.  If the server socket
     # is inherited, it will be held open for 10 seconds
 
-    set f [open script1 w]
+    set f [open $path(script1) w]
     puts $f {
 	after 20000 exit
 	vwait forever
@@ -1464,17 +1469,17 @@
     # launches script1 and exits.  If the child process inherited the
     # client socket, the socket will still be open.
 
-    set f [open script2 w]
+    set f [open $path(script2) w]
     puts $f [list set tcltest $::tcltest::tcltest]
-    puts $f {
+    puts $f [format {
         gets stdin port
 	set f [socket 127.0.0.1 $port]
-	exec $tcltest script1 &
+	exec $tcltest "%s" &
 	puts $f testing
 	flush $f
 	after 1000 exit
 	vwait forever
-    }
+    } $path(script1)]
     close $f
 
     # Create the server socket
@@ -1521,7 +1526,7 @@
     # Launch the script2 process
     ### exec $::tcltest::tcltest script2 &
 
-    set p [open "|[list $::tcltest::tcltest script2]" w]
+    set p [open "|[list $::tcltest::tcltest $path(script2)]" w]
     puts $p [lindex [fconfigure $server -sockname] 2] ; flush $p
 
     vwait x
@@ -1537,33 +1542,33 @@
     removeFile script1
     removeFile script2
 
-    set f [open script1 w]
+    set f [open $path(script1) w]
     puts $f {
 	after 10000 exit
 	vwait forever
     }
     close $f
 
-    set f [open script2 w]
+    set f [open $path(script2) w]
     puts $f [list set tcltest $::tcltest::tcltest]
-    puts $f {
+    puts $f [format {
 	set server [socket -server accept 0]
 	puts stdout [lindex [fconfigure $server -sockname] 2]
 	proc accept { file host port } {
 	    global tcltest
 	    puts $file {test data on socket}
-	    exec $tcltest script1 &
+	    exec $tcltest "%s" &
 	    after 1000 exit
 	}
 	vwait forever
-    }
+    } $path(script1)]
     close $f
 
     # Launch the script2 process and connect to it.  See how long
     # the socket stays open
 
     ## exec $::tcltest::tcltest script2 &
-    set p [open "|[list $::tcltest::tcltest script2]" r]
+    set p [open "|[list $::tcltest::tcltest $path(script2)]" r]
     gets $p listen
 
     after 1000 set ok_to_proceed 1
Index: tests/winPipe.test
===================================================================
RCS file: /cvsroot/tcl/tcl/tests/winPipe.test,v
retrieving revision 1.16
diff -u -r1.16 winPipe.test
--- tests/winPipe.test	24 May 2002 22:43:31 -0000	1.16
+++ tests/winPipe.test	4 Jul 2002 19:59:07 -0000
@@ -38,11 +38,13 @@
 append big $big
 append big $big
 
-set f [open "little" w] 
+set path(little) [makeFile {} little]
+set f [open $path(little) w] 
 puts -nonewline $f "little"
 close $f
 
-set f [open "big" w]
+set path(big) [makeFile {} big]
+set f [open $path(big) w]
 puts -nonewline $f $big
 close $f
 
@@ -53,83 +55,84 @@
     set r
 }
 
-set f [open more w]
-puts $f {
+set path(more) [makeFile {
     while {[eof stdin] == 0} {
 	puts -nonewline [read stdin]
     }
-}
-close $f
+} more]
+
+set path(stdout) [makeFile {} stdout]
+set path(stderr) [makeFile {} stderr]
 
 test winpipe-1.1 {32 bit comprehensive tests: from little file} {pcOnly stdio cat32} {
-    exec $cat32 < little > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 < $path(little) > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {little stderr32}
 test winpipe-1.2 {32 bit comprehensive tests: from big file} {pcOnly stdio cat32} {
-    exec $cat32 < big > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 < $path(big) > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } "{$big} stderr32"
 test winpipe-1.3 {32 bit comprehensive tests: a little from pipe} {nt stdio cat32} {
-    exec $::tcltest::tcltest more < little | $cat32 > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $::tcltest::tcltest more < little | $cat32 > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {little stderr32}
 test winpipe-1.4 {32 bit comprehensive tests: a lot from pipe} {nt stdio cat32} {
-    exec $::tcltest::tcltest more < big | $cat32 > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $::tcltest::tcltest more < big | $cat32 > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } "{$big} stderr32"
 test winpipe-1.5 {32 bit comprehensive tests: a lot from pipe} {95 stdio cat32} {
-    exec command /c type big |& $cat32 > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec command /c type big |& $cat32 > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } "{$big} stderr32"
 test winpipe-1.6 {32 bit comprehensive tests: from console} \
 	{pcOnly stdio cat32 AllocConsole} {
     # would block waiting for human input
 } {}
 test winpipe-1.7 {32 bit comprehensive tests: from NUL} {pcOnly stdio cat32} {
-    exec $cat32 < nul > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 < nul > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {{} stderr32}
 test winpipe-1.8 {32 bit comprehensive tests: from socket} {pcOnly stdio cat32} {
     # doesn't work
 } {}
 test winpipe-1.9 {32 bit comprehensive tests: from nowhere} \
 	{pcOnly stdio cat32 .console} {
-    exec $cat32 > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {{} stderr32}
 test winpipe-1.10 {32 bit comprehensive tests: from file handle} \
 	{pcOnly stdio cat32} {
-    set f [open "little" r]
-    exec $cat32 <@$f > stdout 2> stderr
+    set f [open $path(little) r]
+    exec $cat32 <@$f > $path(stdout) 2> $path(stderr)
     close $f
-    list [contents stdout] [contents stderr]
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {little stderr32}
 test winpipe-1.11 {32 bit comprehensive tests: read from application} \
 	{pcOnly stdio cat32} {
-    set f [open "|[list $cat32] < little" r]
+    set f [open "|[list $cat32] < $path(little)" r]
     gets $f line
     catch {close $f} msg
     list $line $msg
 } {little stderr32}
 test winpipe-1.12 {32 bit comprehensive tests: a little to file} \
 	{pcOnly stdio cat32} {
-    exec $cat32 < little > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 < $path(little) > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {little stderr32}
 test winpipe-1.13 {32 bit comprehensive tests: a lot to file} \
 	{pcOnly stdio cat32} {
-    exec $cat32 < big > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 < $path(big) > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } "{$big} stderr32"
 test winpipe-1.14 {32 bit comprehensive tests: a little to pipe} \
 	{pcOnly stdio cat32} {
-    exec $cat32 < little | $::tcltest::tcltest more > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 < $path(little) | $::tcltest::tcltest $path(more) > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {little stderr32}
 test winpipe-1.15 {32 bit comprehensive tests: a lot to pipe} \
 	{pcOnly stdio cat32} {
-    exec $cat32 < big | $::tcltest::tcltest more > stdout 2> stderr
-    list [contents stdout] [contents stderr]
+    exec $cat32 < $path(big) | $::tcltest::tcltest $path(more) > $path(stdout) 2> $path(stderr)
+    list [contents $path(stdout)] [contents $path(stderr)]
 } "{$big} stderr32"
 test winpipe-1.16 {32 bit comprehensive tests: to console} {pcOnly stdio cat32} {
     catch {exec $cat32 << "You should see this\n" >@stdout} msg
@@ -137,27 +140,27 @@
 } stderr32
 test winpipe-1.17 {32 bit comprehensive tests: to NUL} {pcOnly stdio cat32} {
     # some apps hang when sending a large amount to NUL.  $cat32 isn't one.
-    catch {exec $cat32 < big > nul} msg
+    catch {exec $cat32 < $path(big) > nul} msg
     set msg
 } stderr32
 test winpipe-1.18 {32 bit comprehensive tests: to nowhere} \
 	{pcOnly stdio cat32 .console} {
-    exec $cat32 < big >&@stdout 
+    exec $cat32 < $path(big) >&@stdout 
 } {}
 test winpipe-1.19 {32 bit comprehensive tests: to file handle} {pcOnly stdio cat32} {
-    set f1 [open "stdout" w]
-    set f2 [open "stderr" w]
-    exec $cat32 < little >@$f1 2>@$f2
+    set f1 [open $path(stdout) w]
+    set f2 [open $path(stderr) w]
+    exec $cat32 < $path(little) >@$f1 2>@$f2
     close $f1
     close $f2
-    list [contents stdout] [contents stderr]
+    list [contents $path(stdout)] [contents $path(stderr)]
 } {little stderr32}
 test winpipe-1.20 {32 bit comprehensive tests: write to application} \
 	{pcOnly stdio cat32} {
-    set f [open |[list $cat32 >stdout] w]
+    set f [open |[list $cat32 >$path(stdout)] w]
     puts -nonewline $f "foo"
     catch {close $f} msg
-    list [contents stdout] $msg
+    list [contents $path(stdout)] $msg
 } {foo stderr32}
 test winpipe-1.21 {32 bit comprehensive tests: read/write application} \
 	{pcOnly stdio cat32} {
@@ -187,13 +190,13 @@
 	}
     }
 
-    set f [open "|[list $cat32] < big 2> stderr" r]
+    set f [open "|[list $cat32] < big 2> $path(stderr)" r]
     fconfigure $f  -buffering none -blocking 0
     fileevent $f readable "readResults $f"
     set x 0
     set result ""
     vwait x
-    list $result $x [contents stderr]
+    list $result $x [contents $path(stderr)]
 } "{$big} 1 stderr32"
 
 close [open nothing w]
@@ -279,16 +282,16 @@
     lappend x [catch {close $f} msg] $msg
 } {writable timeout 0 {}}
 
-makeFile {
+set path(echoArgs.tcl) [makeFile {
     puts "[list $argv0 $argv]"
-} echoArgs.tcl
+} echoArgs.tcl]
 
 test winpipe-7.1 {BuildCommandLine: null arguments} {pcOnly stdio} {
-    exec $::tcltest::tcltest echoArgs.tcl foo "" bar
-} {echoArgs.tcl {foo {} bar}}
+    exec $::tcltest::tcltest $path(echoArgs.tcl) foo "" bar
+} [list $path(echoArgs.tcl) {foo {} bar}]
 test winpipe-7.2 {BuildCommandLine: null arguments} {pcOnly stdio} {
-    exec $::tcltest::tcltest echoArgs.tcl foo \" bar
-} {echoArgs.tcl {foo {"} bar}}
+    exec $::tcltest::tcltest $path(echoArgs.tcl) foo \" bar
+} [list $path(echoArgs.tcl) {foo {"} bar}]
 
 # restore old values for env(TMP) and env(TEMP)
 
