Overview
| Artifact ID: | 9855ffae96552a5c5729626bc256e45ef0af2c83 |
|---|---|
| Ticket: | 84af1192f514f190a1d14f31394ced8b6816e633
"regsub -all c.*" is errorneously compiled to "string map" |
| User & Date: | oehhar on 2014-09-08 12:04:27 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed 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 changed to: "8.6.2"
- is_private changed to: "0"
- login: "oehhar"
- priority changed to: "5 Medium"
- private_contact changed to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution changed to: "None"
- severity changed to: "Critical"
- status changed to: "Open"
- submitter changed to: "oehhar"
- subsystem changed to: "43. Regexp"
- title changed to:
"regsub -all c.*" is errorneously compiled to "string map"
- type changed to: "Bug"