delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/11/21/00:16:51

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: Tcl bug
21 Nov 1998 00:16:51 -0800 :
Message-ID: <Pine.SUN.3.93.981120111256.14891C-100000.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <AA09161 DOT 9811191818 AT slug DOT ncl DOT ac DOT uk>
Mime-Version: 1.0
To: Albert Koelmans <Albert DOT Koelmans AT newcastle DOT ac DOT uk>
Cc: GNU win32 mailing list <gnu-win32 AT cygnus DOT com>

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
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019