This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Tcl bug


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@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]