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

History Of Ticket 218784ffffffffff

Artifacts Associated With Ticket 218784ffffffffff

  1. Ticket change [e0ba12e406] (rid 87328) by nobody on 2000-10-26 01:05:19:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 2117 Bug
      Version: 8.1
      SubmitDate: '1999-05-21'
      LastModified: '1999-08-04'
      Severity: CRIT
      Status: Released
      Submitter: pat
      ChangedBy: stanton
      OS: Windows 98
      Machine: X86
      FixedDate: '1999-06-01'
      FixedInVersion: 8.2b1
      ClosedDate: '2000-10-25'
      
      
      Name:
      Christopher Nelson
      
      Comments:
      Same behaviour on W98 and WNT with 8.1b2 and 8.1.0
      
      ReproducibleScript:
      set fields {Name Birthdate Notes}
          set re "(?ix)               # Ignore case (i), expanded syntax (x)
                  ^                   # Start at the start of the string
                  ([join $fields |])  # Match and capture any field names
                  :                   #   followed by a colon
                  \\s*                # Optional white space after the colon
                  (.*?)               # Capture the rest of the line
                  \\s*                #   excluding trailing whitespace
                  $                   # Use the whole line
                  "                  ;# Can't comment after the " without a ; to 
                                      # terminate the set command
          # Open the input file
          set fid [open redata.txt r]
          # While not done, read and process the next line
          while {! [eof $fid] } {
              set len [gets $fid line]
              switch -- $len {
          0 {
              # Skip blank lines
              continue
          }
          -1 {
              # EOF
              break
          }
              }
              # See if we can parse this line
              if { ! [regexp $re $line whole field value] } {
                 puts stderr "No field found in <<$line>>"
                 continue
              }
              # Use case-insensitive regexp to match fields
              # We could do "set field [string toupper $field]"
              switch -regexp -- $field {
                  (?i)NAME {
                      set name $value
                      lappend a(names) $name
                  }
                  (?i)BIRTHDATE {
                      set a($name,dob) [clock scan $value]
                  }
                  (?i)NOTES {
                      set a($name,notes) $value
                  }
                  default {
              puts "no match in switch"
          }
              }
          }
          close $fid
          
          
          Where redata.txt contains:
          
          Name: Fred Flintstone   
          birthdate:4/1/01
          notes: Member, water buffalo lodge
          name:Barney Rubble
          birthdate:5/15/09
          notes: NOT the purple Barney!
      
      ObservedBehavior:
      If the second capture is "(.*?)", this script hangs. If I remove the
          non-greedy qualifier, it works (but value is left with trailing
          whitespace).
          
          This script works:
          
          set fields {Name Birthdate Notes}
          set line "Name: Fred Flintstone   "
          # This works but leaves value with trailing white space
          set re "(?ix)^([join $fields |]):\\s*(.*)\\s*$"
          puts [regexp $re $line whole field value]
          puts "<<$value>>"
          # This tries to make (.*) non-greedy (so trailing white space is
          trimmed)
          set re "(?ix)^([join $fields |]):\\s*(.*?)\\s*$"
          puts [regexp $re $line whole field value]
          puts "<<$value>>"
          
          The only difference seems to be that the regexp isn't expanded.
      
      DesiredBehavior:
      Expanded format shouldn't cause a valid RE to hang Tcl
      
      
      
      I've forwarded this bug to Henry Spencer.
      05/27/1999 11:23 - stanton -
      06/01/1999 18:44 - stanton -Henry sent us a patch that fixes this problem.  It has been applied to the CVS repository.
      
      
      
    4. foundin initialized to: "obsolete: 8.1"
    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: "43. Regexp"
    10. title initialized to: "regexp hangs with non-greedy option in expanded RE"
    11. type initialized to: "Bug"
  2. Ticket change [1beb94ad9a] (rid 123236) by welch on 2000-10-26 08:29:14:

    1. closedate changed to: "2000-10-26T01:29:14"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"