Tk Source Code

View Ticket
Login
Ticket UUID: 1da19a69f8ce6bf055ee40ed66c28f8470496ac4
Title: Backspace crashes 9.0 interpreter on FreeBSD
Type: Bug Version: 9.0.1
Submitter: jo.mos Created on: 2025-01-22 10:53:34
Subsystem: 18. [text] Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2025-01-29 06:28:07
Resolution: Fixed Closed By: fvogel
    Closed on: 2025-01-29 06:28:07
Description:
Even on a very basic installation pressing backspace inside a entry or text widget that contains a character ends up in a core dump.

I'm using Tcl/Tk 9.0.1 build from source on a FreeBSD 14.2 amd64 system. Using GNU "make" instead of FreeBSDs "make" doesn't matter, and as far I know not every FreeBSD crashes - the one from the package maintainer f.e. doesn't. I've switched to brand new hardware & brand new installation and got the same result: core dump. Also on a blank, new virtual machine or using a new, fresh user account. All crashing machines got one thing in common: A Ryzen CPU without GPU, instead there's a separate graphic card. That's the only thing I could imagine when it comes to "what may differ your systems from others"…

So I've build Tcl/Tk with "--enable-symbols", and here you can find a core dump:

  https://jmos.net/tcl/tclsh9.0.core

The executed testfile:

---------------------------------------------
#!/usr/local/bin/tclsh9.0
package require Tk
text .t
pack .t
---------------------------------------------

Pressing "q" and then backspace leads to the linked core dump.
User Comments: fvogel added on 2025-01-29 06:28:07:
The fix was merged on 25 Jan 2025. Closing, thanks.

jo.mos added on 2025-01-25 13:42:40:
Works :) Many thanks!

jan.nijtmans added on 2025-01-25 12:22:57:

Please try [f5940667b0a4e61f|this] commit (the previous one was based on Tk 8.7).


jan.nijtmans added on 2025-01-25 11:33:23:

I suspect that on FreeBSD, the ICU symbols don't have a version number, but the library name itself has. That's strange, no other platform has that.

Does [7501e0f130b359e0|this] help? (I don't have FreeBSD available to test)


fvogel added on 2025-01-25 09:29:32:

Thank, that's perfect. I'll attach the back traces to this ticket for future reference.

What's happening is that, when pressing the "q" key, the <<PrevChar>> binding triggers which runs tk::TextSetCursor %W [tk::TextPrevPos %W insert tk::startOfCluster] (with %W getting substituted by ".t").

::tk::startOfCluster executes startEndOfCmd() in tkIcu.c, and the crash happens in the call to icu_open() at tkIcu.c:102. There is no further debugging symbols available at this point.

So this looks like a bug in TIP#621 implementation. Jan, could you please have a look?


jo.mos added on 2025-01-25 06:15:39:
Hm… I was once told: If a "stack trace" is desired, I simply have to provide a core dump… So I don't really know what to do, but somewhere I read that "gdb" is the tool to debug such a core dump. So I've done a "gdb path/to/tclsh9.0 mytestfile" and entered "bt" "and "bt full":

  https://jmos.net/tcl/bt.txt
  https://jmos.net/tcl/bt_full.txt

I hope this is what is needed; Otherwise I need more specifics on what to do (as I am not familiar with core dumps and back traces…).

fvogel added on 2025-01-24 21:41:53:
Until I can find out how to make use of the provided core file, are you able to provide a stack trace (with --enable-symbols) please?

Attachments: