Bug 606671 - tk segfaults without font (Type1) installed
Summary: tk segfaults without font (Type1) installed
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: tk   
(Show other bugs)
Version: 6.0
Hardware: All
OS: Linux
Target Milestone: rc
: ---
Assignee: Jaroslav Škarvada
QA Contact: BaseOS QE - Apps
Depends On:
TreeView+ depends on / blocked
Reported: 2010-06-22 08:11 UTC by Aleš Mareček
Modified: 2013-10-31 14:18 UTC (History)
4 users (show)

Fixed In Version: tk-8.5.7-5.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2010-11-10 21:47:06 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
reproducer (695 bytes, application/octet-stream)
2010-06-22 08:11 UTC, Aleš Mareček
no flags Details
backtrace (1.11 KB, text/plain)
2010-06-23 11:29 UTC, Jan Kaluža
no flags Details
proposed patch (399 bytes, patch)
2010-06-23 12:49 UTC, Jan Kaluža
no flags Details | Diff
misc font fallback (313 bytes, patch)
2010-06-23 14:01 UTC, Jaroslav Škarvada
no flags Details | Diff

Description Aleš Mareček 2010-06-22 08:11:36 UTC
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

How reproducible:

Steps to Reproduce:
1. run attached "555730.rb" test on X
Actual results:

Expected results:
No segfaults, prints some info / error message

Additional info:
It doesn't segfault after Type1 installed:
$ rpm -qa | grep xorg-x11-fonts

See backtraces by Akira Tagoh:
 * https://bugzilla.redhat.com/attachment.cgi?id=425839
 * https://bugzilla.redhat.com/attachment.cgi?id=425840

Comment 1 Jan Kaluža 2010-06-23 11:28:38 UTC
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.

Comment 2 Jan Kaluža 2010-06-23 11:29:11 UTC
Created attachment 426239 [details]

Comment 3 Aleš Mareček 2010-06-23 11:58:52 UTC
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.

Comment 7 Jan Kaluža 2010-06-23 12:49:45 UTC
Created attachment 426256 [details]
proposed patch

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'
        from 555730.rb:11

Comment 8 Jaroslav Škarvada 2010-06-23 14:01:39 UTC
Created attachment 426277 [details]
misc font fallback

This patch add misc font to fallback.

Comment 9 Jaroslav Škarvada 2010-06-24 23:56:37 UTC
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.

Comment 10 Jaroslav Škarvada 2010-06-25 07:42:00 UTC
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.

Comment 11 Aleš Mareček 2010-06-25 15:01:17 UTC
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.

Comment 14 releng-rhel@redhat.com 2010-11-10 21:47:06 UTC
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.

Comment 15 Ray Strode [halfline] 2013-10-31 14:18:23 UTC
Also see bug 1025331

Note You need to log in before you can comment on or make changes to this bug.