Skip to content
Tcl Source Code History Of Ticket 84af1192f5
Login

History Of Ticket 84af1192f5

Artifacts Associated With Ticket 84af1192f5

  1. Ticket change [9855ffae96] (rid 139716) by oehhar on 2014-09-08 12:04:27:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      Эдуард Зозуля reported on clt :
      
      regsub result is different with tcl 8.5.6 and 8.6.2:
      <verbatim>
      set a "123(qwe)"
      
      in tcl 8.6
      # regsub -all "\\(.*" $a ""
      123qwe)
      
      in tcl 8.5
      # regsub -all "\\(.*" $a ""
      123
      </verbatim>
      
      Donal analyzed that this is due to the fact, that the regsub is compiled to string map: (Donals writing follows):
      
      That's definitely a bug, and it is related to the -all option in
      [regsub] and how things are compiled to bytecode. The engine itself has
      no problem.
      <verbatim>
         % regexp -inline "\\(.*" $a
         (qwe)
         % tcl::unsupported::disassemble script {regsub -all "\\(.*" $a ""}
         ByteCode 0x0x10304a410, refCt 1, epoch 15, interp 0x0x100829a10
      (epoch 15)
           Source "regsub -all \"\\(.*\" $a \"\""
           Cmds 1, src 25, inst 9, litObjs 3, aux 0, stkDepth 3, code/src 0.00
           Commands 1:
               1: pc 0-7, src 0-24
           Command 1: "regsub -all \"\\(.*\" $a \"\""
             (0) push1 0         # "("
             (2) push1 1         # ""
             (4) push1 2         # "a"
             (6) loadStk
             (7) strmap
             (8) done
      </verbatim>
      Conversion to a [string map]? I don't think that's possibly right! (The
      problem is that the condition used for conversion here is right for
      [string match] but not [string map]. Ugh.)
      
      Have you filed a bug report yet? This one's serious. Also, removing the
      -all option will work fine in this case; it's never actually useful with
      a trailing “.*” in the pattern.
      
      Original clt thread:
      [https://groups.google.com/forum/#!topic/comp.lang.tcl/HUdJ2suZVPI]
      
    5. foundin initialized to: "8.6.2"
    6. is_private initialized to: "0"
    7. login: "oehhar"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
    10. resolution initialized to: "None"
    11. severity initialized to: "Critical"
    12. status initialized to: "Open"
    13. submitter initialized to: "oehhar"
    14. subsystem initialized to: "43. Regexp"
    15. title initialized to:
      "regsub -all c.*" is errorneously compiled to "string map"
      
    16. type initialized to: "Bug"
  2. Ticket change [961d3dfd0d] (rid 139717) by dgp on 2014-09-08 13:46:21:

    1. icomment:
      Bug introduced to trunk in
      
      http://core.tcl.tk/tcl/info/8e20d1a93f
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [7c1effa3a8] (rid 139721) by dgp on 2014-09-08 14:30:53:

    1. icomment:
      Bug originates in
      
      http://core.tcl.tk/tcl/info/d2d9a5c8de
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [4baf89a187] (rid 139734) by aku on 2014-09-08 17:39:43:

    1. login: "aku"
    2. mimetype: "text/plain"
    3. priority changed to: "7 High"
  5. Ticket change [3603687644] (rid 139777) by dkf on 2014-09-09 19:15:43:

    1. icomment:
      Problem is in the analysis of the results of <tt>TclReToGlob()</tt>; something which produces a <tt>*</tt> in the pattern has to be rejected when we're going to a <tt>strmap</tt>-instruction-based implementation.
      
    2. login: "dkf"
    3. mimetype: "text/html"
    4. username: "dkf"
  6. Ticket change [57f14f8663] (rid 139796) by dkf on 2014-09-09 19:55:29:

    1. closedate changed to: "2456910.33020735"
    2. closer changed to: "dkf"
    3. icomment:
      Minimal test is to look at result of:
      <pre>
      regsub -all {\(.*} 123(qwe) ""
      </pre>
      Which should be 3 characters long.
      <p>
      This is now fixed. The problem was that the <tt>.*</tt> at the end of the pattern was being interpreted as if it wasn't there, which is correct for non-capturing <tt>regexp</tt> but wrong for <tt>regsub</tt> (which is effectively always capturing).
      <p>
      There would have also been a problem with this more unusual pattern (it's the same cause as above, the identical bug and the identical fix):
      <pre>
      regsub -all {.*\(} 123(qwe) ""
      </pre>
      
    4. login: "dkf"
    5. mimetype: "text/html"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"