Red Hat Bugzilla – Bug 606671
tk segfaults without font (Type1) installed
Last modified: 2013-10-31 10:18:23 EDT
Created attachment 425852 [details]
Description of problem:
Tk segfaults when you run simple program (under X) uses tk libraries and you don't have font (Type1) installed.
Version-Release number of selected component (if applicable):
$ rpm -qa | grep xorg-x11-fonts
Steps to Reproduce:
1. run attached "555730.rb" test on X
No segfaults, prints some info / error message
It doesn't segfault after Type1 installed:
$ rpm -qa | grep xorg-x11-fonts
See backtraces by Akira Tagoh:
I was able to reproduce this bug, but only in situation when all fonts was removed. In that case, whole gnome environment was not usable ("squares" instead of letters, firefox crashed too etc.). So it would be fine to know if you have some additional fonts installed.
I'm also attaching backtrace created with tk debugging symbols.
Created attachment 426239 [details]
I had only the xorg-x11-fonts-misc-7.2-9.1.el6.noarch. I understand that X are not very usable in this installation but... in situation where is possible to create this type of installation without forcing it should not segfaults.
Created attachment 426256 [details]
This patch fixes the crash in libtk, but maybe it would be better to find out another way which could allow to run tk applications with some font from xorg-x11-fonts-misc package.
After applying the patch, reproducer ends up with following ruby exception:
/usr/lib/ruby/1.8/tk.rb:1970:in `_invoke_without_enc': unhandled exception
from /usr/lib/ruby/1.8/tk.rb:1970:in `_ip_invoke_core'
from /usr/lib/ruby/1.8/tk.rb:2006:in `_tk_call_core'
from /usr/lib/ruby/1.8/tk.rb:2034:in `tk_call_without_enc'
from /usr/lib/ruby/1.8/tk.rb:5103:in `create_self'
from /usr/lib/ruby/1.8/tk.rb:5058:in `initialize'
from 555730.rb:11:in `new'
Created attachment 426277 [details]
misc font fallback
This patch add misc font to fallback.
The Tk is compiled with xft support by default, thus the fallback approach from comment 8 is not usable (it is only for old X11 core font system). The actual problem is that the fontconfig doesn't see the misc font. It is because the fontconfig is configured -with-add-fonts=/usr/share/X11/fonts/Type1,/usr/share/X11/fonts/TTF,/usr/local/share/fonts and does not scan directories recursively (documented feature).
In order to make it work with misc font add the following line to your /etc/fonts/fonts.conf:
Then wait for fontconfig refresh (cca 30 seconds) or run 'fc-cache -f'
Also bitmap fonts must be enabled in fontconfig (by default they are).
Probably this would fix other affected applications as well.
The segfault if there is no font seen by fontconfig is fixed in tk-8.5.7-5.el6 but the test script doesn't run. In order to make it work please follow the comment 9.
Thanks Jaroslav, it seems it works well (https://bugzilla.redhat.com/show_bug.cgi?id=606671#c9).
After adding "<dir>/usr/share/X11/fonts/misc</dir>" in /etc/fonts/fonts.conf it doesn't segfault.
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.
Also see bug 1025331