Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 10a4dd14b5e11cd6a5af6cf15b0079d06c1206f0
Ticket: 218702ffffffffffffffffffffffffffffffffff
not always compile with writeable string
User & Date: nobody on 2000-10-26 01:04:18
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 1793 RFE
    Version: 8.1b3
    SubmitDate: '1999-04-13'
    LastModified: '1999-05-03'
    Severity: LOW
    Status: Released
    Submitter: pat
    ChangedBy: stanton
    OS: Solaris
    OSVersion: 5.5.1
    Machine: Other
    FixedDate: '1999-05-03'
    FixedInVersion: 8.1.1
    ClosedDate: '2000-10-25'
    
    
    Name:
    
    Peter Weigand
    
    
    
    Comments:
    
    This patch may not work for all not writeable strings.
    
    
    
    DesiredBehavior:
    
    If you have a Tcl_Eval(interp, "do_my_command"); it does a segmentation
    
        error if you haven't compiled it with writeable strings.
    
        I have a small patch which will work for such one commands Tcl_Eval's
    
        and you do not need to make strings writeable.
    
    
    
    Patch:
    
    *** tclParse.cFri Apr  2 02:13:25 1999
    
    --- tclParse.c.newTue Apr 13 14:01:01 1999
    
    ***************
    
    *** 277,283 ****
    
    --- 277,285 ----
    
           */
    
      
    
          savedChar = string[numBytes];
    
    +     if (savedChar != 0) {/* not writeable? */
    
          string[numBytes] = 0;
    
    +     }
    
      
    
          /*
    
           * Parse any leading space and comments before the first word of the
    
    ***************
    
    *** 473,483 ****
    
    --- 475,489 ----
    
      
    
      
    
          parsePtr->commandSize = src - parsePtr->commandStart;
    
    +     if (savedChar != 0) {/* not writeable? */
    
          string[numBytes] = (char) savedChar;
    
    +     }
    
          return TCL_OK;
    
      
    
          error:
    
    +     if (savedChar != 0) {/* not writeable? */
    
          string[numBytes] = (char) savedChar;
    
    +     }
    
          if (parsePtr->tokenPtr != parsePtr->staticTokens) {
    
      ckfree((char *) parsePtr->tokenPtr);
    
      parsePtr->tokenPtr = parsePtr->staticTokens;
    
    
    
    PatchFiles:
    
    tclParse.c
    
    
    
    
    
    This patch just avoids the problem in the case where you are passing exactly one word to eval.  
    
    This is really a documentation bug.  The Tcl_Eval manual entry needs to be clear that all strings passed to it must be writable.
    04/15/1999 10:19 - stanton -
    
    The patch avoids modifying strings that are already null terminated.  This should be safe since the action is a noop in any case.  Applied the patch.
    05/03/1999 16:47 - stanton -
    
    
    
  4. foundin changed to: "obsolete: 8.1b3"
  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: "46. Traces"
  10. title changed to: "not always compile with writeable string"
  11. type changed to: "Bug"