Skip to content
Tcl Source Code History Of Ticket 3b6b1c4e495f11ad
Login

History Of Ticket 3b6b1c4e495f11ad

Artifacts Associated With Ticket 3b6b1c4e495f11ad

  1. Ticket change [8b1c2f3162] (rid 216057) by pointsman on 2023-06-30 08:47:28:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/x-fossil-plain"
    4. comment initialized to:
      There is Tcl code which runs with Tcl 8.6 or 8.7 but hangs (runs
      infinite) with Tcl 9.
      
      Unfortunately I wasn't able to nail this down to a small,
      stripped-down example of the problem. But there is an short recipt to
      demonstrate the problem. You need an installed Tcl 9 and a tcllib
      repository.
      
      Inside your tcllib check-out do:
      
      fossil update tcl9-testarea-rde
      
      Then run
      
      tclsh sak.tcl test run --shell /path/to/your/tcl/9/installation/tclsh9.0 base64
      
      This runs infinitely.
      
      If you run this with a path to a Tcl 8.6 or 8.7 tclsh with the --shell
      option this runs to an end as expected.
      
      While I was not able to find the crucial actions on script level to
      trigger that I found that tclsh9.0 endlessly loops in
      [https://core.tcl-lang.org/tcl/file?udc=1&ln=4640-4647&ci=trunk&name=generic%2FtclBasic.c]
      (attached to the running process with gdb and analysed).
      
      Bisecing turned out to be not so much enlightening:
      
      2018-10-08 19:36:29 [acd6c0661e] BAD
      2018-10-08 19:00:39 [f3d49044c4] GOOD
      
    5. foundin initialized to: "9.0"
    6. is_private initialized to: "0"
    7. login: "pointsman"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
    10. resolution initialized to: "None"
    11. severity initialized to: "Severe"
    12. status initialized to: "Open"
    13. submitter initialized to: "pointsman"
    14. subsystem initialized to: "None"
    15. title initialized to: "Tcl 9.0 hangs infinitely"
    16. type initialized to: "Bug"
  2. Ticket change [716d03a481] (rid 216065) by pointsman on 2023-06-30 09:56:50:

    1. icomment:
      Forgot to note/provide the line at script level where it hangs. It's this gets call:
      
      [https://core.tcl-lang.org/tcllib/file?udc=1&ln=310&ci=tip&name=support%2Fdevel%2Fsak%2Ftest%2Frun.tcl]
      
    2. login: "pointsman"
    3. mimetype: "text/x-fossil-plain"
  3. Ticket change [143f60663d] (rid 216068) by pointsman on 2023-06-30 12:08:42:

    1. closedate changed to: "2460126.00604227"
    2. closer changed to: "pointsman"
    3. icomment:
      After discussing and analysing this further with the support of the
      nice fellows on the Tclers chat (thanks folks!) it turned out that
      this is a combination of a coding practice which worked at that time
      and for the Tcl version aimed for but does not anymore due to Tcl 9
      variable resolution changes with another Tcl 9 change (TIP 514).
      
      So this is not a bug of the Tcl 9 code base (but a lesson about on
      what script level patterns to look for while porting script code to
      Tcl 9.)
      
      Let me explain a bit more. Turned out the crucial code is this:
      [https://core.tcl-lang.org/tcllib/file?udc=1&ln=90-98&ci=tip&name=modules%2Fcrc%2Fcrc32.tcl]
      
      That code is evaluated in a namespace. Therefor, with Tcl < 9 the line
      [https://core.tcl-lang.org/tcllib/file?udc=1&ln=90&ci=tip&name=modules%2Fcrc%2Fcrc32.tcl]
      resolved the (unprefixed) tcl_platform in the global namespace. Tcl 9
      does not do that anymore.
      
      Because of this the code branch
      [https://core.tcl-lang.org/tcllib/file?udc=1&ln=93-97&ci=tip&name=modules%2Fcrc%2Fcrc32.tcl]
      got evaluated. Then another Tcl 9 changes come into play: TIP 514,
      making the int() math function not to do truncation any more. That
      means that the algorithm at that place does not work anymore (but
      runs infinite until the number get so big that it reaches other
      limits).
      
      The code runs on 8.7 because that still has the "resolve the variable
      in the global namespace if it doesn't exists in the namespace"
      behaviour.
      
    4. login: "pointsman"
    5. mimetype: "text/x-fossil-plain"
    6. resolution changed to: "Invalid"
    7. status changed to: "Closed"