Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 62124ce7171ec0a8b6a482bcfd2484d759bc4966
Ticket: 686782ffffffffffffffffffffffffffffffffff
Changes to Tcl_SetObjLength() break "expect -re"
User & Date: rmax on 2003-02-18 02:04:26
Changes

  1. icomment:
    Logged In: YES 
    user_id=124643
    
    Further investigation has shown, that at a point where
    expect's match buffer starts growing rapidly, it's string
    and unicode rep get out of sync. This means, the string rep
    changes, but the unicode rep, that is used for regexp
    matching stays the same. I hve instrumented
    Tcl_RegExpExecObj() to show the difference:
    
        Tcl_DString ds;
    ...
        Tcl_DStringInit(&ds);
        Tcl_UniCharToUtfDString(udata, length, &ds);
        fprintf(stderr, ">> string: %s\n", Tcl_GetString(objPtr));
        fprintf(stderr, ">>unicode: %s\n", Tcl_DStringValue(&ds));
        Tcl_DStringFree(&ds);
    
    Normally the two strings printed should always be the same,
    but after some time, the unicode rep seems to "freeze" while
    the string rep keeps walking trough the input with an offset
    according to the first match withing the unicode rep. Here
    is an example of another test script (attached) at the point
    where it happens:
    
    --- here it is still ok ---
    >> string: abc
    defg
    >>unicode: abc
    defg
    
    --- and here it happens... ---
    >> string: defg
    hijkl
    >>unicode: abc
    defg
    
    From there on, the unicode rep will remain the same while
    the string rep keeps changing.
    
    I suppose, that either expect doesn't correctly invalidate
    the unicode rep when it changes the string rep, or that
    Tcl_SetObjLength() does something wrong with the
    representations under certain conditions that are triggered
    by expect.
    
    
    
  2. login: "rmax"
  3. mimetype: "text/plain"
  4. title changed to: "Changes to Tcl_SetObjLength() break "expect -re""
  5. username: "rmax"