summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2009-05-08 08:13:31 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2009-05-08 08:13:31 (GMT)
commit0aacbdde5731d13b37f89453b2c72c1ff5250a51 (patch)
tree7f95c74f3f1c8af101acabb8b52ff11e55f5c4ef
parentb0db7876f6b3796fdaaf44512cf1fb86966b870d (diff)
downloadtcl-0aacbdde5731d13b37f89453b2c72c1ff5250a51.zip
tcl-0aacbdde5731d13b37f89453b2c72c1ff5250a51.tar.gz
tcl-0aacbdde5731d13b37f89453b2c72c1ff5250a51.tar.bz2
Fix [Bug 2788468].
-rw-r--r--ChangeLog35
-rw-r--r--tests/exec.test93
2 files changed, 71 insertions, 57 deletions
diff --git a/ChangeLog b/ChangeLog
index 76314a1..7a7bb1b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,12 +1,17 @@
+2009-05-08 Donal K. Fellows <dkf@users.sf.net>
+
+ * tests/exec.test (cat): [Bug 2788468]: Adjust the scripted version of
+ cat so that it does not perform transformations on the data it is
+ working with, making it more like the standard Unix 'cat' program.
+
2009-05-07 Miguel Sofer <msofer@users.sf.net>
- * generic/tclObj.c (Tcl_GetCommandFromObj): fix for bug [2785893],
- insure that a command in a deleted namespace cannot be found
- through a cached name.
-
- * generic/tclBasic.c: Let coroutines start with a much smaller
- * generic/tclCompile.h: stack: 200 words (previously was 2000,
- * generic/tclExecute.c: the same as interps)
+ * generic/tclObj.c (Tcl_GetCommandFromObj): [Bug 2785893]: Ensure that
+ a command in a deleted namespace can't be found through a cached name.
+
+ * generic/tclBasic.c: Let coroutines start with a much smaller
+ * generic/tclCompile.h: stack: 200 words (previously was 2000, the
+ * generic/tclExecute.c: same as interps).
2009-05-07 Donal K. Fellows <dkf@users.sf.net>
@@ -37,8 +42,8 @@
2009-04-30 Miguel Sofer <msofer@users.sf.net>
- * generic/tclBasic.c (TclObjInvoke): Make sure that a null objProc
- is not used, use Tcl_NRCallObjProc instead [Bug 2486550].
+ * generic/tclBasic.c (TclObjInvoke): [Bug 2486550]: Make sure that a
+ null objProc is not used, use Tcl_NRCallObjProc instead.
2009-05-01 Jan Nijtmans <nijtmans@users.sf.net>
@@ -47,8 +52,8 @@
2009-04-28 Jeff Hobbs <jeffh@ActiveState.com>
- * unix/tcl.m4, unix/configure (SC_CONFIG_CFLAGS): harden the check
- to add _r to CC on AIX with threads.
+ * unix/tcl.m4, unix/configure (SC_CONFIG_CFLAGS): harden the check to
+ add _r to CC on AIX with threads.
2009-04-27 Donal K. Fellows <dkf@users.sf.net>
@@ -71,7 +76,7 @@
* library/http/http.tcl: [Bug 2715421]: Removed spurious newline added
* tests/http11.test: after POST and added tests to detect excess
- * tests/httpd11.tcl: bytes being POSTed.
+ * tests/httpd11.tcl: bytes being POSTed.
* library/http/pkgIndex.tcl:
* makefiles: package version now 2.8.1
@@ -115,7 +120,7 @@
want to run the tcl event loop via
Tcl_ServiceModeHook(TCL_SERVICE_ALL).
- * macosx/tclMacOSXNotify.c: add CFRunLoop based Tcl_Sleep() and
+ * macosx/tclMacOSXNotify.c: add CFRunLoop based Tcl_Sleep() and
* unix/tclUnixChan.c: TclUnixWaitForFile() implementations
* unix/tclUnixEvent.c: and disable select() based ones in
CoreFoundation builds.
@@ -150,7 +155,7 @@
* tools/tclZIC.tcl: Always emit files with Unix line termination.
* library/tzdata: Olson's tzdata2009e
-
+
2009-04-09 Don Porter <dgp@users.sourceforge.net>
* library/http/http.tcl: [Bug 26245326]: Handle incomplete
@@ -169,7 +174,7 @@
2009-04-08 Don Porter <dgp@users.sourceforge.net>
* library/tcltest/tcltest.tcl: [Bug 2570363]: Converted [eval]s (some
- * library/tcltest/pkgIndex.tcl: unsafe!) to {*} in tcltest package.
+ * library/tcltest/pkgIndex.tcl: unsafe!) to {*} in tcltest package.
* unix/Makefile.in: => tcltest 2.3.1
* win/Makefile.in:
diff --git a/tests/exec.test b/tests/exec.test
index 297278f..61b818e 100644
--- a/tests/exec.test
+++ b/tests/exec.test
@@ -11,7 +11,7 @@
# See the file "license.terms" for information on usage and redistribution of
# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: exec.test,v 1.32 2009/05/07 10:34:42 dkf Exp $
+# RCS: @(#) $Id: exec.test,v 1.33 2009/05/08 08:13:31 dkf Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -39,6 +39,7 @@ set path(cat) [makeFile {
if {$argv eq ""} {
set argv -
}
+ fconfigure stdout -translation binary
foreach name $argv {
if {$name eq "-"} {
set f stdin
@@ -46,6 +47,7 @@ set path(cat) [makeFile {
puts stderr $f
continue
}
+ fconfigure $f -translation binary
while {[eof $f] == 0} {
puts -nonewline [read $f]
}
@@ -72,7 +74,7 @@ set path(sh) [makeFile {
set newcmd {}
foreach arg $cmd {
if {$arg eq ";"} {
- eval exec >@stdout 2>@stderr [list [info nameofexecutable]] $newcmd
+ exec >@stdout 2>@stderr [info nameofexecutable] {*}$newcmd
set newcmd {}
continue
}
@@ -92,7 +94,7 @@ set path(sh2) [makeFile {
set newcmd {}
foreach arg $cmd {
if {$arg eq ";"} {
- eval exec -ignorestderr >@stdout [list [info nameofexecutable]] $newcmd
+ exec -ignorestderr >@stdout [info nameofexecutable] {*}$newcmd
set newcmd {}
continue
}
@@ -218,37 +220,37 @@ test exec-3.7 {redirecting output to file} {exec} {
file delete $path(gorp.file)
test exec-4.1 {redirecting output and stderr to file} {exec} {
- exec [interpreter] "$path(echo)" "test output" >& $path(gorp.file)
- exec [interpreter] "$path(cat)" "$path(gorp.file)"
+ exec [interpreter] $path(echo) "test output" >& $path(gorp.file)
+ exec [interpreter] $path(cat) $path(gorp.file)
} "test output"
test exec-4.2 {redirecting output and stderr to file} {exec} {
- list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" >&$path(gorp.file)] \
- [exec [interpreter] "$path(cat)" "$path(gorp.file)"]
+ list [exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" >&$path(gorp.file)] \
+ [exec [interpreter] $path(cat) $path(gorp.file)]
} {{} {foo bar}}
test exec-4.3 {redirecting output and stderr to file} {exec} {
exec [interpreter] $path(echo) "first line" > $path(gorp.file)
- list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" >>&$path(gorp.file)] \
- [exec [interpreter] "$path(cat)" "$path(gorp.file)"]
+ list [exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" >>&$path(gorp.file)] \
+ [exec [interpreter] $path(cat) $path(gorp.file)]
} "{} {first line\nfoo bar}"
test exec-4.4 {redirecting output and stderr to file} {exec} {
- set f [open "$path(gorp.file)" w]
+ set f [open $path(gorp.file) w]
puts $f "Line 1"
flush $f
- exec [interpreter] "$path(echo)" "More text" >&@ $f
- exec [interpreter] "$path(echo)" >&@$f "Even more"
+ exec [interpreter] $path(echo) "More text" >&@ $f
+ exec [interpreter] $path(echo) >&@$f "Even more"
puts $f "Line 3"
close $f
- exec [interpreter] "$path(cat)" "$path(gorp.file)"
+ exec [interpreter] $path(cat) $path(gorp.file)
} "Line 1\nMore text\nEven more\nLine 3"
test exec-4.5 {redirecting output and stderr to file} {exec} {
- set f [open "$path(gorp.file)" w]
+ set f [open $path(gorp.file) w]
puts $f "Line 1"
flush $f
- exec >&@ $f [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2"
- exec >&@$f [interpreter] "$path(sh)" -c "\"$path(echo)\" xyzzy 1>&2"
+ exec >&@ $f [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2"
+ exec >&@$f [interpreter] $path(sh) -c "\"$path(echo)\" xyzzy 1>&2"
puts $f "Line 3"
close $f
- exec [interpreter] "$path(cat)" "$path(gorp.file)"
+ exec [interpreter] $path(cat) $path(gorp.file)
} "Line 1\nfoo bar\nxyzzy\nLine 3"
# I/O redirection: input from file.
@@ -287,14 +289,14 @@ test exec-5.7 {redirecting input from file} -constraints {exec} -body {
# I/O redirection: standard error through a pipeline.
test exec-6.1 {redirecting stderr through a pipeline} {exec stdio} {
- exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar" |& [interpreter] "$path(cat)"
+ exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar" |& [interpreter] $path(cat)
} "foo bar"
test exec-6.2 {redirecting stderr through a pipeline} {exec stdio} {
- exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" |& [interpreter] "$path(cat)"
+ exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" |& [interpreter] $path(cat)
} "foo bar"
test exec-6.3 {redirecting stderr through a pipeline} {exec stdio} {
- exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" \
- |& [interpreter] "$path(sh)" -c "\"$path(echo)\" second msg 1>&2 ; \"$path(cat)\"" |& [interpreter] "$path(cat)"
+ exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" \
+ |& [interpreter] $path(sh) -c "\"$path(echo)\" second msg 1>&2 ; \"$path(cat)\"" |& [interpreter] $path(cat)
} "second msg\nfoo bar"
# I/O redirection: combinations.
@@ -344,12 +346,12 @@ test exec-9.5 {commands returning errors} -constraints {exec stdio} -body {
exec gorp456 | [interpreter] echo a b c
} -returnCodes error -result {couldn't execute "gorp456": no such file or directory}
test exec-9.6 {commands returning errors} -constraints {exec} -body {
- exec [interpreter] "$path(sh)" -c "\"$path(echo)\" error msg 1>&2"
+ exec [interpreter] $path(sh) -c "\"$path(echo)\" error msg 1>&2"
} -returnCodes error -result {error msg}
test exec-9.7 {commands returning errors} -constraints {exec stdio nonPortable} -body {
# This test can fail easily on multiprocessor machines
- exec [interpreter] "$path(sh)" -c "\"$path(echo)\" error msg 1>&2 ; \"$path(sleep)\" 1" \
- | [interpreter] "$path(sh)" -c "\"$path(echo)\" error msg 1>&2 ; \"$path(sleep)\" 1"
+ exec [interpreter] $path(sh) -c "\"$path(echo)\" error msg 1>&2 ; \"$path(sleep)\" 1" \
+ | [interpreter] $path(sh) -c "\"$path(echo)\" error msg 1>&2 ; \"$path(sleep)\" 1"
} -returnCodes error -result {error msg
error msg}
set path(err) [makeFile {} err]
@@ -560,27 +562,27 @@ test exec-14.5 {-ignorestderr switch} {exec} {
# Redirecting standard error separately from standard output
test exec-15.1 {standard error redirection} {exec} {
- exec [interpreter] "$path(echo)" "First line" > "$path(gorp.file)"
- list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" 2> "$path(gorp.file)"] \
- [exec [interpreter] "$path(cat)" "$path(gorp.file)"]
+ exec [interpreter] $path(echo) "First line" > $path(gorp.file)
+ list [exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" 2> $path(gorp.file)] \
+ [exec [interpreter] $path(cat) $path(gorp.file)]
} {{} {foo bar}}
test exec-15.2 {standard error redirection} {exec stdio} {
- list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" \
- | [interpreter] "$path(echo)" biz baz >$path(gorp.file) 2> "$path(gorp.file2)"] \
- [exec [interpreter] "$path(cat)" "$path(gorp.file)"] \
- [exec [interpreter] "$path(cat)" "$path(gorp.file2)"]
+ list [exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" \
+ | [interpreter] $path(echo) biz baz >$path(gorp.file) 2> $path(gorp.file2)] \
+ [exec [interpreter] $path(cat) $path(gorp.file)] \
+ [exec [interpreter] $path(cat) $path(gorp.file2)]
} {{} {biz baz} {foo bar}}
test exec-15.3 {standard error redirection} {exec stdio} {
- list [exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" \
- | [interpreter] "$path(echo)" biz baz 2>$path(gorp.file) > "$path(gorp.file2)"] \
- [exec [interpreter] "$path(cat)" "$path(gorp.file)"] \
- [exec [interpreter] "$path(cat)" "$path(gorp.file2)"]
+ list [exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" \
+ | [interpreter] $path(echo) biz baz 2>$path(gorp.file) > $path(gorp.file2)] \
+ [exec [interpreter] $path(cat) $path(gorp.file)] \
+ [exec [interpreter] $path(cat) $path(gorp.file2)]
} {{} {foo bar} {biz baz}}
test exec-15.4 {standard error redirection} {exec} {
- set f [open "$path(gorp.file)" w]
+ set f [open $path(gorp.file) w]
puts $f "Line 1"
flush $f
- exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" 2>@ $f
+ exec [interpreter] $path(sh) -c "\"$path(echo)\" foo bar 1>&2" 2>@ $f
puts $f "Line 3"
close $f
readfile $path(gorp.file)
@@ -588,14 +590,14 @@ test exec-15.4 {standard error redirection} {exec} {
foo bar
Line 3}
test exec-15.5 {standard error redirection} {exec} {
- exec [interpreter] "$path(echo)" "First line" > "$path(gorp.file)"
+ exec [interpreter] $path(echo) "First line" > "$path(gorp.file)"
exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" 2>> "$path(gorp.file)"
readfile $path(gorp.file)
} {First line
foo bar}
test exec-15.6 {standard error redirection} {exec stdio} {
exec [interpreter] "$path(sh)" -c "\"$path(echo)\" foo bar 1>&2" > "$path(gorp.file2)" 2> "$path(gorp.file)" \
- >& "$path(gorp.file)" 2> "$path(gorp.file2)" | [interpreter] "$path(echo)" biz baz
+ >& "$path(gorp.file)" 2> "$path(gorp.file2)" | [interpreter] $path(echo) biz baz
list [readfile $path(gorp.file)] [readfile $path(gorp.file2)]
} {{biz baz} {foo bar}}
test exec-15.7 {standard error redirection 2>@1} {exec stdio} {
@@ -624,7 +626,7 @@ test exec-16.2 {flush output before exec} {exec} {
Second line
Third line}
-test exec-17.1 { inheriting standard I/O } -constraints {exec} -setup {
+test exec-17.1 {inheriting standard I/O} -constraints {exec} -setup {
set path(script) [makeFile {} script]
set f [open $path(script) w]
puts $f [list lassign [list \
@@ -645,7 +647,13 @@ test exec-17.1 { inheriting standard I/O } -constraints {exec} -setup {
removeFile $path(script)
} -result {{} foobar}
-test exec-18.1 { exec cat deals with weird file names} -body {
+test exec-18.1 {exec deals with weird file names} -body {
+ set path(fooblah) [makeFile {contents} "foo\[\{blah"]
+ exec [interpreter] $path(cat) $path(fooblah)
+} -constraints {exec} -cleanup {
+ removeFile $path(fooblah)
+} -result contents
+test exec-18.2 {exec cat deals with weird file names} -body {
# This is cross-platform, but the cat isn't predictably correct on
# Windows.
set path(fooblah) [makeFile {contents} "foo\[\{blah"]
@@ -655,7 +663,8 @@ test exec-18.1 { exec cat deals with weird file names} -body {
} -result contents
# Note that this test cannot be adapted to work on Windows; that platform has
-# no kernel support for an analog of O_APPEND.
+# no kernel support for an analog of O_APPEND. OTOH, that means we can assume
+# that there is a POSIX shell...
test exec-19.1 {exec >> uses O_APPEND} -constraints {exec unix} -setup {
set tmpfile [makeFile {0} tmpfile.exec-19.1]
} -body {