Skip to content
Tcl Source Code History Of Ticket eabb2f5613b6996e
Login

History Of Ticket eabb2f5613b6996e

Artifacts Associated With Ticket eabb2f5613b6996e

  1. Ticket change [b1498ba8e4] (rid 178701) by sebres on 2020-01-20 20:19:19:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-wiki"
    4. comment initialized to:
      Today I tried to find some sporadic issue, so trying to start last code piece of [5adbede0722cb22f] multiple times (using timerate call) ends with "extra characters after close-brace" (because of "}" in catch in <code>[catch ...]</code>).
      where whole code running "good" if copy&pasted into the shell (then it takes "}" as a options variable, try <code>set \}</code> to see that).
      
      The result is quasi similar "undefined behavior", just compare following:
      <code><pre style=padding:10pt><b style="color:green">% eval "puts }"
      }</b>
      <b style="color:red">% if 1 { eval "puts }" }
      extra characters after close-brace</b>
      </pre></code>
      and
      <code><pre style=padding:10pt><b style="color:green">% eval "puts \}"
      }
      % if 1 { eval "puts \}" }
      }</b>
      </pre></code>
      I could fix that, but do not really know how:
      <ol>
      <li>either <code>eval "puts }"</code> should cause some (parse) error</li>
      <li>or <code>if 1 { eval "puts }" }</code> should avoid an error too (must consider open quotes and square brackets)</li>
      </ol>
      The decision is something for a syntax evangelists (@TCT).
      
      Anyway if parser works differently on certain circumstances (e. g. some code becomes enclosed or copied in other code within braces) - it is pretty good definition of UB.
      
      In my opinion the parser shall to work always in the same way... because it may be obvious on some small code pieces, but can cause real burning brain on some unpaired brace in large codes with many nested quotes/brackets/braces.<br/>
      Especially if code is created "dynamically" (some template engine mixing Tcl with some other lang, like html), so you've to look on some interim result of pre-processor to find the issue.
      
    5. foundin initialized to: "any"
    6. is_private initialized to: "0"
    7. login: "sebres"
    8. priority initialized to: "5 Medium"
    9. resolution initialized to: "None"
    10. severity initialized to: "Severe"
    11. status initialized to: "Open"
    12. submitter initialized to: "sebres"
    13. subsystem initialized to: "45. Parsing and Eval"
    14. title initialized to: "Tcl parser UB (braces vs. quotes/brackets)"
    15. type initialized to: "Bug"
  2. Ticket change [80d37a6909] (rid 178710) by dgp on 2020-01-21 02:03:50:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2458869.58599956"
    3. closer changed to: "dgp"
    4. icomment:
      
      This is not a bug. It is just a demonstration of how brace quoting works.
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Invalid"
    8. status changed to: "Closed"
  3. Ticket change [77e96a3ec3] (rid 178714) by sebres on 2020-01-21 09:14:51:

    1. closedate changed to: "2458869.88532098"
    2. closer changed to: "sebres"
    3. icomment:
      I am aware of that, Don.
      As well as that using of Tcl_FreeResult is still possible in tcl 8.x.
      What does not mean it remains.
      
      I wanted just point to a bit unfavorable parsing in some situations.<br/>
      And a unmatched brace in this Kevin's script <code>[list [catch { a $::depth } result }] ...]</code> was surely a typo, which is not "recognized" by the parser.<br/>
      Some parse error like <code>unpaired brace</code> could be quite imaginable here (in new version).
      
      Another point is: if one must escape unpaired braces in quotes or square brackets in codes enclosed in braces, why it is not obligorish outside of this codes?
      
    4. login: "sebres"
    5. mimetype: "text/x-fossil-wiki"