Skip to content
Tcl Source Code History Of Ticket ecf35c71200d782c
Login

History Of Ticket ecf35c71200d782c

Artifacts Associated With Ticket ecf35c71200d782c

  1. Ticket change [7651e27eb7] (rid 241783) by dgp on 2025-06-20 15:33:36:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      While out on an arduous hunt for a memory leak, I noticed that
      the coding of TclMergeReturnOptions() contains an ordering error
      which can be demonstrated in an interactive session:
      
      % catch {return -level 0 -options {-options {-code break} -code ok}} m o
      3
      % set o
      -code 3 -level 0
      
    5. foundin initialized to: "8.5+"
    6. is_private initialized to: "0"
    7. login: "dgp"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "8e2300e85be5dd1445b9666eb9429055951e33be"
    10. resolution initialized to: "None"
    11. severity initialized to: "Important"
    12. status initialized to: "Open"
    13. submitter initialized to: "dgp"
    14. subsystem initialized to: "45. Parsing and Eval"
    15. title initialized to: "[return]: broken ordering of nested -options"
    16. type initialized to: "Bug"
  2. Ticket change [30b6187c96] (rid 241787) by dgp on 2025-06-20 15:46:49:

    1. icomment:
      
      The documentation says:
      
             -options options
                    The  value  options must be a valid dictionary.  The entries of
                    that dictionary are treated as additional  option  value  pairs
                    for the return command.
      
      While an explicit ordering guarantee is not stated, the description
      suggests a lifting of the dictionary entries out of the dictionary
      to enter the options alongside the other options.
      
      This is the same kind of expansion offered by the {*} syntax, but
      the -options option debuted at the same time as that syntax, when
      reliance on it was unclear.
      
      An explicit aim was to enable a re-raising pattern:
      
          catch $script m o
          return -options $o $m
      
      Had the {*} syntax been better established at the time, we might
      have gone without -options and prescribed:
      
          catch $script m 0
          return {*}$o $m
      
      Whatever precise mental model is in use, we expect later appearances
      of the same option to overwrite earlier ones, so that we reason:
       
          return -level 0 -options {-options {-code break} -code ok}
      
      is same as
      
          return -level 0 -options {-code break} -code ok
      
      is same as
      
          return -level 0 -code break -code ok
      
      is same as
      
          return -level 0 -code ok
      
      and that's not what Tcl is doing.
      
      Nested options are rare.  A single test even attempts it
      (cmdMZ-return-2.14), but doesn't illustrate the bug.
      Not noticed for all this time.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  3. Ticket change [c8e191e8d4] (rid 241788) by dgp on 2025-06-20 15:50:24:

    1. icomment:
      
      Note that only nesting brings out the trouble.
      A single level of -options behaves properly
      
      % catch {return -level 0 -options {-code break} -code ok} m o
      0
      % set o
      -code 0 -level 0
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [2e1c5353c9] (rid 241887) by dgp on 2025-06-23 17:42:17:

    1. icomment:
      
      Branch bug-ecf35c7120 is open to address this ticket.  So far it includes
      tests demonstrating the problem.  Briefly, processing so that the -options
      switch emulates {*} argument expansion is not consistent with standard
      dictionary creation processing in the handling of duplicate keys.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  5. Ticket change [e44c542315] (rid 241889) by dgp on 2025-06-23 19:59:06:

    1. icomment:
      
      A pending fix is committed to the bugfix branch.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  6. Ticket change [64bab9c8b9] (rid 241924) by dgp on 2025-06-24 16:24:36:

    1. assignee changed to: "dgp"
    2. closedate changed to: "2460851.18375855"
    3. closer changed to: "dgp"
    4. icomment:
      
      Fix accepted into the 9.0 branch
      
    5. login: "dgp"
    6. mimetype: "text/plain"
    7. resolution changed to: "Fixed"
    8. status changed to: "Closed"