Tk Source Code

View Ticket
Login
Ticket UUID: 36e379c01b599fa6afb5d1af7a8c38cd892112c0
Title: macOS Ventura, X11 build with XQuartz: crash in XLoadQueryFont
Type: Bug Version: core-8-6-branch
Submitter: fvogel Created on: 2022-10-29 11:49:57
Subsystem: 46. Unix Fonts Assigned To: fvogel
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2024-11-13 20:55:05
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2024-11-13 20:55:05
Description:

Example code:

  package require Tk
  entry .e
  .e insert end "\u4e4e"

Running this on macOS Ventura with an X11 build using XQuartz, it triggers:

X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  45 (X_OpenFont)
  Value in failed request:  0x200011
  Serial number of failed request:  107
  Current serial number in output stream:  108

then execution stops.

The Tk source code does not call X_OpenFont. However I have traced this down to GetScreenFont(). The following call in tkUnixFont.c:2808 generates the message and aborts:

	fontStructPtr = XLoadQueryFont(display, buf);

The error message and execution stop happen before this call returns. The solution is therefore not about checking the fontStructPtr return value for NULL.

When the problem shows up, the value in buf is -apple-geneva-medium-r-normal--12-*-*-*-*-*-iso10646-1

This looks odd because this font definition seems to be provided by XListFonts(), i.e. the X11 server itself provided it.

Note that the example code above is a trimmed down version of test entry-3.24, which crashes on macOS Ventura when run in an X11 build with XQuartz.

User Comments: jan.nijtmans added on 2024-11-13 20:55:05:

The workaround appears to work quite well, I now merged this to all branches.

Closing.


jan.nijtmans added on 2024-09-20 19:19:15:

Sounds like a [7f20f59927a212d2|good idea]


fvogel added on 2024-09-15 10:41:53:

Another way of working around this XQuartz problem without putting more and more constraints on tests is [b128b1a3]. Next time I merge branch less_tests_constraints into core-8-6-branch this will get propagated.


fvogel added on 2024-08-17 09:13:16:
I have observed that this issue triggers or doesn't trigger depending on the mac used to run the tests. It may trigger on the CI runner but not on a real mac, or vice-versa. This is not a stable observation however, I did't manage to dentify what exactly makes the problem disappear or re-appear.

Instead of flagging numerous tests with 'failsOnXQuarz' one could perhaps try to add more fonts in the mac-build.yml workflow file, at least until the problem is fixed in XQuartz itself.

fvogel added on 2024-08-17 08:57:19:

For the record: there is a branch bug-36e379c01b dealing with this ticket.


jan.nijtmans added on 2024-07-01 12:13:59:

It looks like this XQuartz problem popped up on GITHUB:

https://github.com/tcltk/tk/actions/runs/9739591285

Can we just disable - for now - those testcases which trigger the problem?


fvogel added on 2023-07-18 19:38:08:

Hmmm... can't reproduce anymore. XQuartz 2.8.5 (xorg-server 21.1.6).

The XQuartz bug is still open.


fvogel added on 2023-01-08 09:32:34:
Still happening with the latest XQuartz 2.8.4 (xorg-server 21.1.6) dated 2022-12-24.

fvogel added on 2023-01-07 21:19:53:

Thanks for the pointer.

I can again reproduce this with 8.6 on macOS Ventura with --disable-aqua --disable-xft by running:

  package require Tk
  pack [entry .e]
  .e insert end 乎

The Xquartz about box says: XQuartz 2.8.3 (xorg-server 21.1.4).


SVIDevelopment added on 2022-12-19 16:44:11:
This seems to be an issue in Xquartz, see https://github.com/XQuartz/XQuartz/issues/216

fvogel added on 2022-11-23 07:31:22:
Hmm, this does not happen anymore after fossil updating Tcl and Tk to core-8-6-branches (which should not have any link to the issue).

XQuartz about box says: XQuartz 2.82. (xorg-server 1.20.14). Maybe this got upgraded since I reported the crash, I'm unsure.

chrstphrchvz added on 2022-11-23 00:56:39:

What XQuartz distribution/release version was used, in case that is relevant?