Skip to content
Tcl Source Code History Of Ticket 219122ffffffffff
Login

History Of Ticket 219122ffffffffff

Artifacts Associated With Ticket 219122ffffffffff

  1. Ticket change [818f118fc5] (rid 117061) by nobody on 2000-10-26 01:11:05:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 6284 Bug
      Version: 8.4a1
      SubmitDate: '2000-09-19'
      LastModified: '2000-09-19'
      Severity: MED
      Status: Released
      Submitter: techsupp
      ChangedBy: ericm
      OS: Linux-Red Hat
      OSVersion: Redhat 7.0beta
      FixedDate: '2000-09-19'
      FixedInVersion: 8.4a2
      ClosedDate: '2000-10-25'
      
      
      Name:
      
      Mark Patton
      
      
      
      CustomShell:
      
      Moved a test to set a flag in the
      
      
      
      Comments:
      
      Since the regexp using "-start" works I checked the code and noticed
      
          that the TCL_REG_NOTBOL flag is only set when the "-start" flag is given
      
          and offset > 0. It should really be set any time when offset > 0 ie.
      
          when looping through a string with "-all".
      
      
      
      ReproducibleScript:
      
      % regexp -all -inline ^a aaaa
      
      a a a a
      
      
      
      % regexp -all -inline -start 1 ^a aaaa
      
      
      
      ObservedBehavior:
      
      I expected only one a to be matched in the first regexp because only one
      
      a is at the beginning of the string.
      
      
      
      Note that the second regexp correctly matches nothing.
      
      
      
      DesiredBehavior:
      
      The -all option should respect the "^" constraint and only match once.
      
      
      
      Patch:
      
      *** tclCmdMZ.c.origSun Sep 10 11:59:34 2000
      
      --- tclCmdMZ.cMon Sep 11 20:50:55 2000
      
      ***************
      
      *** 248,261 ****
      
        return TCL_OK;
      
            }
      
        
      
      -     if (offset > 0) {
      
      - /*
      
      -  * Add flag if using offset (string is part of a larger string),
      
      -  * so that "^" won't match.
      
      -  */
      
      - eflags |= TCL_REG_NOTBOL;
      
      -     }
      
      - 
      
            objc -= 2;
      
            objv += 2;
      
            resultPtr = Tcl_GetObjResult(interp);
      
      --- 248,253 ----
      
      ***************
      
      *** 289,294 ****
      
      --- 281,294 ----
      
             */
      
        
      
            while (1) {
      
      +         if (offset > 0) {
      
      +    /*
      
      +     * Add flag if using offset (string is part of a larger string),
      
      +     * so that "^" won't match.
      
      +     */
      
      +     eflags |= TCL_REG_NOTBOL;
      
      +         }
      
      + 
      
        match = Tcl_RegExpExecObj(interp, regExpr, objPtr,
      
        offset /* offset */, numMatchesSaved, eflags);
      
      
      
      PatchFiles:
      
      tclCmdMZ.c
      
      
      
      
      
      Thanks for reporting this bug.  I elected to fix it slightly differently than you did:
      
      
      *** tclCmdMZ.c  2000/09/06 18:31:36     1.29
      
      --- tclCmdMZ.c  2000/09/20 01:32:56
      
      ***************
      
      *** 433,438 ****
      
      --- 433,439 ----
      
              }
      
              offset += info.matches[0].end;
      
              all++;
      
      +       eflags |= TCL_REG_NOTBOL;
      
              if (offset >= stringLength) {
      
                  break;
      
              }
      
      
      This fix avoids the additional "if" test each time through the while loop.  We know that offset will be non-zero every time through the while loop after the first, so the "if (offset > 0)" test is redundant.
      
      
      Thanks for reporting and suggesting a fix!
      
      
         Eric Melski                            The Other Tcl Guy
      
         ericm at ajubasolutions.com            Ajuba Solutions
      
      
      -- 09/19/2000 ericm
      
      
      
    4. foundin initialized to: "obsolete: 8.4a1"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: "regexp -all handles "^" incorrectly"
    11. type initialized to: "Bug"
  2. Ticket change [ba9ceb3da0] (rid 129351) by welch on 2000-10-26 08:34:57:

    1. closedate changed to: "2000-10-26T01:34:57"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [e9420c93da] (rid 104791) by dgp on 2001-04-20 02:50:55:

    1. closedate changed to: "2001-04-19T19:50:55"
    2. closer changed to: "dgp"
    3. subsystem changed to: "18. Commands M-Z"
    4. title changed to: "regexp -all handles "^" incorrectly"