Subject: Re: Tcl bug
From: [email-masked] (Mumit Khan)

21 Nov 1998 00:16:51 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
To: Albert Koelmans <[email-masked]>
Cc: GNU win32 mailing list <[email-masked]>

On Thu, 19 Nov 1998, Albert Koelmans wrote:

> 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.

First one is definitely not a bug and the second one you're running into
system limits quite possibly (Tcl uses win32 api to start "echo", and
the command line may be too long).

>   # problem 1: no output in a bash from the following lines of code
> puts $contents

Wish on win32 doesn't have a console, so this goes nowhere. It's not a
bug in Tcl. There are ways around it (eg., using TkCon from Jeffrey
Hobbes, or redefine puts to put stuff in text window). Tclsh on the
other hand does have a console and this will work there.

>   # problem 2: only 260 characters arrive in the different
>   # files. The rest is lost on the way - whereever ...
> exec echo $contents >contents.file

Why in the world are you using echo and redirection to do this?? Tcl has
well-behaved and -defined set of I/O functions that  do this portably
on all platforms. 

260 may be a command line arg limit. Comments anyone?

Writing portable Tcl code takes a while, but not anything tricky. One
trick is to avoid OS utilities (such as grep, echo, etc) as much as
you can.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".