Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1f0f181ff880afb60da3893b8887eb89b65732c3
Ticket: 217886ffffffffffffffffffffffffffffffffff
info complete gives wrong answer
User & Date: nobody on 2000-10-26 00:45:23
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 2382 Bug
    Version: 8.2b1
    SubmitDate: '1999-07-16'
    LastModified: '1999-07-29'
    Severity: LOW
    Status: Closed
    Submitter: techsupp
    ChangedBy: redman
    RelatedBugIDs: 2466
    OS: Other
    Machine: NA
    FixedDate: '1999-07-21'
    ClosedDate: '1999-07-29'
    
    
    Name:
    
    Peter Spjuth
    
    
    
    ObservedBehavior:
    
    info complete returns 1 for a string missing a close 
    
        bracket, if the last char is a close bracket:
    
        
    
        % info complete {[a [b]}
    
        1
    
        
    
        By adding a space:
    
        
    
        % info complete {[a [b] }
    
        0
    
        
    
        They are also treated slightly differently by eval,
    
        the difference is that the error is caught later in the
    
        buggy case:
    
        
    
        % eval {[a [b]}
    
        missing close-bracket
    
        % set errorInfo
    
        missing close-bracket
    
            while compiling
    
        "a"
    
            while compiling
    
        "[a [b]"
    
            ("eval" body line 1)
    
            invoked from within
    
        "eval {[a [b]}"
    
        
    
        % eval {[a [b] }
    
        missing close-bracket
    
        % set errorInfo
    
        missing close-bracket
    
            while compiling
    
        "[a [b] "
    
            ("eval" body line 1)
    
            invoked from within
    
        "eval {[a [b] }"
    
        
    
        The bug is in ParseTokens() in tclParse.c
    
        When encountering an open bracket, the rest is parsed until a 
    
        matching close bracket is found, or the string is ended.
    
        After that, the only check is whether the last parsed char was 
    
        a close bracket. No check is made if it was that close bracket, 
    
        or an end of string that terminated the parse.
    
    
    
    Patch:
    
    *** tclParse.orig       Fri Jul 16 22:02:32 1999
    
    --- tclParse.c  Fri Jul 16 22:23:54 1999
    
    ***************
    
    *** 607,613 ****
    
                    if (nested.tokenPtr != nested.staticTokens) {
    
                        ckfree((char *) nested.tokenPtr);
    
                    }
    
    !               if ((src[-1] == ']') && !nested.incomplete) {
    
                        break;
    
                    }
    
                    if (src == parsePtr->end) {
    
    --- 607,614 ----
    
                    if (nested.tokenPtr != nested.staticTokens) {
    
                        ckfree((char *) nested.tokenPtr);
    
                    }
    
    !               if ((*nested.term != 0) && (src[-1] == ']')
    
    !                       && !nested.incomplete) {
    
                        break;
    
                    }
    
                    if (src == parsePtr->end) {
    
    
    
    PatchFiles:
    
    tclParse.c (CVS 1.8)
    
    
    
    
    
    Applied patch, added test case.  Fixed in 8.2b2. 
    -- 07/21/1999 redman
    Bad patch, removed changes.  The patch breaks other test cases on Unix but not Windows.  Needs more investigation.
    
    -- 07/23/1999 redman
    See 2466, new patch.
    
    -- 07/29/1999 redman
    
    
    
  4. foundin changed to: "obsolete: 8.2b1"
  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: "info complete gives wrong answer"
  11. type changed to: "Bug"