Bug 606671 - tk segfaults without font (Type1) installed
tk segfaults without font (Type1) installed
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: tk (Show other bugs)
6.0
All Linux
low Severity high
: rc
: ---
Assigned To: Jaroslav Škarvada
BaseOS QE - Apps
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-22 04:11 EDT by Aleš Mareček
Modified: 2013-10-31 10:18 EDT (History)
4 users (show)

See Also:
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 16:47:06 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
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 04:11 EDT, Aleš Mareček
no flags Details
backtrace (1.11 KB, text/plain)
2010-06-23 07:29 EDT, Jan Kaluža
no flags Details
proposed patch (399 bytes, patch)
2010-06-23 08:49 EDT, Jan Kaluža
no flags Details | Diff
misc font fallback (313 bytes, patch)
2010-06-23 10:01 EDT, Jaroslav Škarvada
no flags Details | Diff

  None (edit)
Description Aleš Mareček 2010-06-22 04:11:36 EDT
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 07:28:38 EDT
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 07:29:11 EDT
Created attachment 426239 [details]
backtrace
Comment 3 Aleš Mareček 2010-06-23 07:58:52 EDT
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 08:49:45 EDT
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 10:01:39 EDT
Created attachment 426277 [details]
misc font fallback

This patch add misc font to fallback.
Comment 9 Jaroslav Škarvada 2010-06-24 19:56:37 EDT
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 03:42:00 EDT
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 11:01:17 EDT
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 16:47:06 EST
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 10:18:23 EDT
Also see bug 1025331

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