Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3564c82704fe1e6d42a18ab30304e6ae921caeb7
Ticket: 218351ffffffffffffffffffffffffffffffffff
bad "eval" behaviour on trailing "\"
User & Date: nobody on 2000-10-26 00:56:35
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    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
    
  4. foundin changed to: "obsolete: 8.3b2"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "69. Other"
  10. title changed to: "bad "eval" behaviour on trailing "\""
  11. type changed to: "Bug"