Bug 606671

Summary: tk segfaults without font (Type1) installed
Product: Red Hat Enterprise Linux 6 Reporter: Aleš Mareček <amarecek>
Component: tkAssignee: Jaroslav Škarvada <jskarvad>
Status: CLOSED CURRENTRELEASE QA Contact: BaseOS QE - Apps <qe-baseos-apps>
Severity: high Docs Contact:
Priority: low    
Version: 6.0CC: jkaluza, jskarvad, ovasik, rstrode
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tk-8.5.7-5.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-10 21:47:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
reproducer
none
backtrace
none
proposed patch
none
misc font fallback none

Description Aleš Mareček 2010-06-22 08:11:36 UTC
Created attachment 425852 [details]
reproducer

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):
tk-8.5.7-4.el6
tcl-8.5.7-5.el6
ruby-1.8.6.399-5.1.el6
ruby-tcltk-1.8.6.399-5.1.el6
rubygems-1.3.5-1.el6.noarch

$ rpm -qa | grep xorg-x11-fonts
xorg-x11-fonts-misc-7.2-9.1.el6.noarch

How reproducible:
Always

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

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

Additional info:
It doesn't segfault after Type1 installed:
$ rpm -qa | grep xorg-x11-fonts
xorg-x11-fonts-misc-7.2-9.1.el6.noarch
xorg-x11-fonts-Type1-7.2-9.1.el6.noarch

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]
backtrace

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:

<dir>/usr/share/X11/fonts/misc</dir>

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