Artifacts Associated With Ticket 84af1192f5
Ticket change [9855ffae96] (rid 139716) by oehhar on 2014-09-08 12:04:27:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-wiki"
- 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] - foundin initialized to: "8.6.2"
- is_private initialized to: "0"
- login: "oehhar"
- priority initialized to: "5 Medium"
- private_contact initialized to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution initialized to: "None"
- severity initialized to: "Critical"
- status initialized to: "Open"
- submitter initialized to: "oehhar"
- subsystem initialized to: "43. Regexp"
- title initialized to:
"regsub -all c.*" is errorneously compiled to "string map"
- type initialized to: "Bug"
Ticket change [961d3dfd0d] (rid 139717) by dgp on 2014-09-08 13:46:21:
- icomment:
Bug introduced to trunk in http://core.tcl.tk/tcl/info/8e20d1a93f
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [7c1effa3a8] (rid 139721) by dgp on 2014-09-08 14:30:53:
- icomment:
Bug originates in http://core.tcl.tk/tcl/info/d2d9a5c8de
- login: "dgp"
- mimetype: "text/plain"
- icomment:
Ticket change [4baf89a187] (rid 139734) by aku on 2014-09-08 17:39:43:
- login: "aku"
- mimetype: "text/plain"
- priority changed to: "7 High"
Ticket change [3603687644] (rid 139777) by dkf on 2014-09-09 19:15:43:
- 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.
- login: "dkf"
- mimetype: "text/html"
- username: "dkf"
- icomment:
Ticket change [57f14f8663] (rid 139796) by dkf on 2014-09-09 19:55:29:
- closedate changed to: "2456910.33020735"
- closer changed to: "dkf"
- 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> - login: "dkf"
- mimetype: "text/html"
- resolution changed to: "Fixed"
- status changed to: "Closed"