From: Albert DOT Koelmans AT newcastle DOT ac DOT uk (Albert Koelmans) Subject: Tcl bug 20 Nov 1998 05:19:22 -0800 Message-ID: Reply-To: Albert DOT Koelmans AT newcastle DOT ac DOT uk Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit To: gnu-win32 AT cygnus DOT com (GNU win32 mailing list) Below is an annotated Tcl script that reproduces what looks like a major string handling bug in B20 Tcl. Text variables with embedded newlines are not properly handeled and output to files is truncated to 260 characters. Puts does not produce any output in Bash. The interpreter is cygwish80. Albert # tcl_bug.tcl # building a simple text widget, just to store some # text longer than 260 chars text .tw pack .tw # inserting the text WITH newlines into the text widget # and a control variable set bla_line "Blablablablablablabla\n" set lot_of_bla {} set i 0 while {$i < 15} { .tw insert end $bla_line set lot_of_bla "$lot_of_bla$bla_line" incr i } ..tw insert end "This is the end." set lot_of_bla "$lot_of_bla This is the end." # another long bla line in ONE piece # WITHOUT newlines, also longer than 260 chars set long_bla_line "BlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaBlablablablablablablaEND" # getting the text back from the text widget set contents [.tw get 1.0 "end - 1 c"] ###### problem section # problem 1: no output in a bash from the following lines of code puts $contents puts $lot_of_bla # problem 2: only 260 characters arrive in the different # files. The rest is lost on the way - whereever ... exec echo $contents >contents.file exec echo [.tw get 1.0 "end - 1 c"] >contents_direct.file exec echo $lot_of_bla >contents_control_bla.file # this line produces the correct result exec echo $long_bla_line >contents_long_bla_line.file - For help on using this list (especially unsubscribing), send a message to "gnu-win32-request AT cygnus DOT com" with one line of text: "help".