Artifacts Associated With Ticket 3b6b1c4e495f11ad
Ticket change [8b1c2f3162] (rid 216057) by pointsman on 2023-06-30 08:47:28:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/x-fossil-plain"
- 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
- foundin initialized to: "9.0"
- is_private initialized to: "0"
- login: "pointsman"
- priority initialized to: "5 Medium"
- private_contact initialized to: "4ca203a8e925aecdd9419645f936bccf18cd6ea7"
- resolution initialized to: "None"
- severity initialized to: "Severe"
- status initialized to: "Open"
- submitter initialized to: "pointsman"
- subsystem initialized to: "None"
- title initialized to: "Tcl 9.0 hangs infinitely"
- type initialized to: "Bug"
Ticket change [716d03a481] (rid 216065) by pointsman on 2023-06-30 09:56:50:
- 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]
- login: "pointsman"
- mimetype: "text/x-fossil-plain"
- icomment:
Ticket change [143f60663d] (rid 216068) by pointsman on 2023-06-30 12:08:42:
- closedate changed to: "2460126.00604227"
- closer changed to: "pointsman"
- 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.
- login: "pointsman"
- mimetype: "text/x-fossil-plain"
- resolution changed to: "Invalid"
- status changed to: "Closed"