summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authorandreas_kupries <andreas_kupries@noemail.net>2002-01-21 20:38:06 (GMT)
committerandreas_kupries <andreas_kupries@noemail.net>2002-01-21 20:38:06 (GMT)
commit483f2761e412527159e14958837b5c7e79234b5a (patch)
treeb55eec77eccf5f16f69e282f66eca0af288d3ee5 /tests/io.test
parentd2e6b6953d1a6c14a417615172f68389da5cdc02 (diff)
downloadtcl-483f2761e412527159e14958837b5c7e79234b5a.zip
tcl-483f2761e412527159e14958837b5c7e79234b5a.tar.gz
tcl-483f2761e412527159e14958837b5c7e79234b5a.tar.bz2
* generic/tclIO.c (WriteChars): Fix for SF #506297, reported by
Martin Forssen <ruric@users.sourceforge.net>. The encoding chosen in the script exposing the bug writes out three intro characters when TCL_ENCODING_START is set, but does not consume any input as TCL_ENCODING_END is cleared. As some output was generated the enclosing loop calls UtfToExternal again, again with START set. Three more characters in the out and still no use of input ... To break this infinite loop we remove TCL_ENCODING_START from the set of flags after the first call (no condition is required, the later calls remove an unset flag, which is a no-op). This causes the subsequent calls to UtfToExternal to consume and convert the actual input. FossilOrigin-Name: 1b53b7b70c86dd98ab6775792ddd47f76248112c
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/io.test b/tests/io.test
index 2d535e6..62cee1f 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -12,7 +12,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: io.test,v 1.22 2001/12/17 22:55:51 andreas_kupries Exp $
+# RCS: @(#) $Id: io.test,v 1.23 2002/01/21 20:38:06 andreas_kupries Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -85,6 +85,19 @@ test io-1.7 {Tcl_WriteChars: WriteChars} {
close $f
contents test1
} "a\x93\xe1\x00"
+test io-1.8 {Tcl_WriteChars: WriteChars} {
+ # This test written for SF bug #506297.
+ #
+ # Executing this test without the fix for the referenced bug
+ # applied to tcl will cause tcl, more specifically WriteChars, to
+ # go into an infinite loop.
+
+ set f [open test2 w]
+ fconfigure $f -encoding iso2022-jp
+ puts -nonewline $f [format %s%c [string repeat " " 4] 12399]
+ close $f
+ contents test2
+} "\x1b(B \x1b\$@\$O"
test io-2.1 {WriteBytes} {
# loop until all bytes are written