Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-19
11:33 • Ticket [218351ffff] bad "eval" behaviour on trailing "\"... artifact: 6a9cde2a50 user: dgp
2000-10-26
08:20 • Closed ticket [218351ffff]. artifact: b50fcdf5ce user: welch
00:56 • New ticket [218351ffff]. artifact: 3564c82704 user: nobody

bad "eval" behaviour on trailing "\"

Closed / Invalid218351ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:56:35
OriginalBugID: 4101 Bug
Version: 8.3b2
SubmitDate: '2000-01-28'
LastModified: '2000-01-28'
Severity: CRIT
Status: Closed
Submitter: techsupp
ChangedBy: hobbs
OS: Windows 98
Machine: PentiumII
FixedDate: '2000-10-25'
ClosedDate: '2000-01-28'


Name:
Enrico Carniani

CustomShell:
No modifications. I'm using the Tk extensions over a user defined C application but it behaves the same way with the given short script.

Comments:
In 8.2, seems to interpret \r as it were a line terminator instead of a
    blank character but does not crash or hang the system.

ReproducibleScript:
set f [open "dostext.tcl" r]
fconfigure $f -translation binary
set DOStext [read $f]
eval "$DOStext"

Note:
DOStext is a text in DOS format (i.e. every line is terminated with \n\r) and
has been read by a C program (here emulated by fconfigure).
If DOStext contains the following 2 lines:

set TRADEMARK  "Telvox Teleinformatica"

tcl libraries would issue an error on the first line (in v8.2) or occasionally
hang the system (v 8.3b2).
Obviously if DOStext.tcl code is executed with wish or tclsh, it works.
The trick of setting binary translation has been made to mime to behaviour of a brutal binary fread in C code (that is, what actually happens with my init application and cannot be changed because TCL sources are crypted).

ObservedBehavior:
In 8.3b2, sometimes hangs or crashes the system.

DesiredBehavior:
Just working.



Responded to user on newsgroup:

I cannot get this to crash on Windows even when I do:
time {catch {eval "$DOStext"}} 10000

This is really not an error for Tcl, because by reading in the file
as binary, you cause the string to actually be:

set TRADEMARK \[\r][\n]    "Telvox Teleinformatica"
or straight as a string:
set TRADEMARK \\\r\n    "Telvox Teleinformatica"

which is equivalent to:

set TRADEMARK "\r"
"Telvox Teleinformatica"

This is all perfectly correct according to the syntax of the
language.  I guess the binary translation is necessary to handle
crypted sources, but then you also have to map {\\r\n} to {\\n }
in the output.  That will make everything happy again.

I'm not sure why you would get a crash, but the equivalent string
you give is such a base case, that the hang must actually from
from somewhere else. 
-- 01/28/2000 hobbs
welch Closed ticket [218351ffff]. [History diff]2000-10-26 08:20:08
dgp Ticket [218351ffff]: 5 changes [History diff]2001-04-19 11:33:33
Log in (anonymous is fine) to add a comment.