Tk Source Code

View Ticket
Login
Ticket UUID: 1687486
Title: tk is not robust in the face of bad xrdb settings
Type: Bug Version: 8.6.18, 9.0.5, 9.1b1
Submitter: jepler Created on: 2007-03-24 17:58:16
Subsystem: 57. [option] Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Open Last Modified: 2026-09-29 09:26:31
Resolution: None Closed By:
    Closed on:
Description:
% echo "*background: stupid-broken-desktop-setting" | xrdb -merge
% wish
Application initialization failed: this isn't a Tk applicationunknown color name "stupid-broken-desktop-setting"

Apparently many linux desktop systems try to set xrdb entries to make old applications look a little more like other desktop applications (details on this are thin, and of course vary between different desktops).  Unfortunately, some of the time this makes all wish applications break.

While the true blame lies at the feet of these desktop environments, it would be nice if Tk was robust in the face of this type of problem.
User Comments: serhiy.storchaka added on 2026-09-29 09:26:31:

Still present in 8.6 and 9.1: a bad X resource for *background, *borderWidth, *relief, *cursor or *highlightThickness stops wish from starting, and a bad *foreground or *font makes most widgets fail to create.

Tk_InitOptions() treats an invalid value from the option database as an error, like an invalid value given explicitly. This is intended and tested (config-3.7, button-2.9). Xt applications print a warning (Cannot convert string ... to type Pixel) and use the default value instead. Tk could do the same for values from the option database, but this changes the tested behaviour, so it needs agreement first.