Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 314583 - Opening the 'save file' and 'preferences' dialog causes firefox to crash.
Summary: Opening the 'save file' and 'preferences' dialog causes firefox to crash.
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High critical (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-10 22:50 UTC by Da Fox
Modified: 2010-04-11 15:38 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Da Fox 2010-04-10 22:50:46 UTC
Whenever I want to download a file in firefox and it asks me where I want to save, firefox crashes as soon as the dialog pops up. The same thing happens when I try to edit preferences, as soon as the dialog pops up, firefox crashes.
This happens every time, making it impossible for me to download anything or edit the firefox preferences.

I've tried different versions of firefox. This started (or seemed to start) when I upgraded to firefox 3.5.8(stable). I have since tried to upgrade to both 3.6.2 and 3.6.3 (both unstable) but with no success. I can not downgrade to any older version because that is no longer in portage, and apparently someone thinks it is wise to not only remove all older ebuilds, but also the files they need. I tried to downgrade to firefox-3.5.2, but this needs some XPI file which is nowhere to be found (not even using google, this yields a number of gentoo ftp mirrors which no longer have the file).

I have since tried all kinds of things, without much luck.
When I run firefox from gdb I get the following:
---8<---------
Program received signal SIGSEGV, Segmentation fault.
0x4df94a0d in FcPatternHash () from /usr/lib/libfontconfig.so.1
(gdb) bt
#0  0x4df94a0d in FcPatternHash () from /usr/lib/libfontconfig.so.1
--->8---------
that's the whole backtrace, not very helpful :(

While running strace I did not really notice anything, but on a hunch a tried something, and that has helped a tiny little bit. What I noticed was that one of the last things firefox did before crashing was to open an icon from my icontheme. I remembered having changed it at about the same time as upgrading.
So I changed my icon theme to something else, and now I could open the preferences dialog again (hurrah for a small victory).
Tracing back I can thus reproduce the crash as follows:
Activate the 'SnowIsh' icon theme (http://gnome-look.org/content/show.php/SnowIsh+SVG+%26+PNG?content=32599)
rename <homedir>/.icons/SnowIsh-1.0/scalable/apps/gtk-help.svg (so it cant't be found). Start firefox. Now I can open the preferences dialog. Close firefox. Rename the icon back. Start firefox. Now I can *not* open the preferences dialog, firefox crashes. Unfortunately I can still not save any files, as this still crashes firefox. I've tried a number of different icon themes, and even no theme at all (renamed <homedir>/.icons), with no effect.

This is extremely annoying, especially if I'm in the middle of doing something and tend to forget that download is broken, causing me to lose my work!

Reproducible: Always

Steps to Reproduce:
A.1. Start firefox
A.2. <alt>-e n (Edit -> Preferences)

B.1. Start firefox
B.2. Navigate to a page with a download link.
B.3. Right-click the download link and select "Save Link As..."



Actual Results:  
A & B : Firefox crashes

Expected Results:  
A: Preferences dialog should show
B: Select download location dialog should show

Portage 2.1.7.17 (default/linux/x86/10.0/desktop, gcc-4.3.4, glibc-2.10.1-r1, 2.6.33-ck1 i686)
=================================================================
System uname: Linux-2.6.33-ck1-i686-Intel-R-_Pentium-R-_M_processor_1.70GHz-with-gentoo-1.12.13
Timestamp of tree: Sat, 10 Apr 2010 15:15:01 +0000
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.4-r1
dev-util/cmake:      2.8.1
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.4_p6, 1.5, 1.7.9-r1, 1.9.6-r2, 1.10.3, 1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.1.2, 4.3.4
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="*"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer -fweb -ffast-math -mtune=pentium-m -mfpmath=sse -mmmx -msse -msse2 -m32"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer -fweb -ffast-math -mtune=pentium-m -mfpmath=sse -mmmx -msse -msse2 -m32"
DISTDIR="/var/tmp/distfiles"
FEATURES="assume-digests distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
GENTOO_MIRRORS="http://ftp.snt.utwente.nl/pub/os/linux/gentoo http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1"
LINGUAS="en"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /usr/local/portage/desktop-effects /usr/local/portage/berkano /usr/local/portage/mozilla"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X a52 aac aalib acpi alsa amr ao apm asf aspell ass audio bash-completion bitmap-fonts bzip2 cairo calendar canna cdparanoia cdr cjk crypt cups curl curlwrappers cxx dbus dga dirac directfb dllloader dri dvd dvdnav emerald encode exif expat faac faad fam fbcon fbcondecor ffmpeg firefox flac fontconfig freetype ftp gd gdbm ggi gif glitz glut gnutls gpm graphviz gtk hal howl imagemagick imlib ipv6 irda java javascript jpeg jpeg2k kdehiddenvisibility libcaca libnotify lua mad madwifi matroska midi mmap mmx mmxext mozilla mp3 mpeg mpi mplayer msn musepack musicbrainz nas ncurses network nls nntp nptl nptlonly nsplugin offensive ogg openal opengl openmp pam pango pascal pcap pcf pcmcia pdf perl png posix ppds python quicktime readline rtc samba sasl sdl sharedmem snmp sockets speex spell srt sse sse2 ssl startup-notification subversion svg svga tcl tetex theora threads thunar tiff timidity tk truetype type1 type1-fonts udev unicode usb userlocales vcd vorbis webdav-neon wifi win32codecs wmf x264 x86 xanim xcomposite xft xine xinerama xinetd xml xorg xosd xpm xrandr xscreensaver xulrunner xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks                   iec958 ioplug ladspa lfloat linear meter mulaw multi null plug                   rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" LIRC_DEVICES="userspace sir" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon ati vesa" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Da Fox 2010-04-10 22:53:07 UTC
I see I forgot to mention that this happens even with a fresh <homedir>/.mozilla directory.
Comment 2 Thomas Kahle (RETIRED) gentoo-dev 2010-04-11 01:14:52 UTC
Hi, I'm running a setup very similar to yours and I have never seen such a problem. It is potentially related to your CFLAGS. 

For instance from the gcc manual:

 -ffast-math

    This option allows GCC to violate some ANSI or IEEE rules and/or specifications in the interest of optimizing code for speed. For example, it allows the compiler to assume arguments to the sqrt function are non-negative numbers and that no floating-point values are NaNs.

    This option should never be turned on by any -O option since it can result in incorrect output for programs that depend on an exact implementation of IEEE or ANSI rules/specifications for math functions.
----

Then debugging can not work with -fomit-frame-pointer. Also trouble could be related to 

-fweb

    Constructs webs as commonly used for register allocation purposes and assign each web individual pseudo register. This allows the register allocation pass to operate on pseudos directly, but also strengthens several other optimization passes, such as CSE, loop optimizer and trivial dead code remover. It can, however, make debugging impossible, since variables will no longer stay in a “home register”. 
------------

In your position I would try to replace your CFLAGS with
CFLAGS="-march=pentium-m -O2 -pipe" 

then recompile fontconfig, firefox and xulrunner, and check again.

Even if the problem persists it could be hidden somewhere down the dependency chain of these programs.

Hope this helps.
Comment 3 Da Fox 2010-04-11 10:02:29 UTC
(In reply to comment #2)
> Hi, I'm running a setup very similar to yours and I have never seen such a
> problem. It is potentially related to your CFLAGS. 
> 
> For instance from the gcc manual:
> 
>  -ffast-math
> 
>     This option allows GCC to violate some ANSI or IEEE rules and/or
> specifications in the interest of optimizing code for speed. For example, it
> allows the compiler to assume arguments to the sqrt function are non-negative
> numbers and that no floating-point values are NaNs.
> 
>     This option should never be turned on by any -O option since it can result
> in incorrect output for programs that depend on an exact implementation of IEEE
> or ANSI rules/specifications for math functions.
> ----
> 
> Then debugging can not work with -fomit-frame-pointer. Also trouble could be
> related to 
> 
> -fweb
> 
>     Constructs webs as commonly used for register allocation purposes and
> assign each web individual pseudo register. This allows the register allocation
> pass to operate on pseudos directly, but also strengthens several other
> optimization passes, such as CSE, loop optimizer and trivial dead code remover.
> It can, however, make debugging impossible, since variables will no longer stay
> in a “home register”. 
> ------------
> 
> In your position I would try to replace your CFLAGS with
> CFLAGS="-march=pentium-m -O2 -pipe" 
> 
> then recompile fontconfig, firefox and xulrunner, and check again.
> 
> Even if the problem persists it could be hidden somewhere down the dependency
> chain of these programs.
> 
> Hope this helps.
> 

I realize your objections are all very valid, and I am aware that some of those options are advertised as potentially harmful. The only really 'troublesome' flag however is --ffast-math, both --fomit-frame-pointer and --fweb are safe, albeit that they (as you say) prevent(make it very difficult to do) debugging. Then again, I'm not in the habit of debugging my system programs, so that should be fine. 
However I have not had this problem prior to upgrading to firefox 3.5.8, and every other program still works perfectly. So I'm confident that it is something in firefox that has broken. Especially for the open/browse/save dialogs I feel the cause must be firefox, since every other program's open/browse/save dialog still works. 
I have already been trying other versions of some of the dependencies of firefox, e.g. older versions of fontconfig and newer versions of cairo, gtk+, librsvg and pango but without luck.

I will try your suggestion however just to be sure, and add -g to the option as well (I will be recompiling those packages with my own cflags again eventually) and see if I can get a better backtrace. I will report back here when that's done.
Comment 4 Da Fox 2010-04-11 13:19:10 UTC
Ok I've tried some things, and it seems you are (partially) correct.
When I compile fontconfig with the following CFLAGS:
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer -fweb -mtune=pentium-m -mfpmath=sse -mmmx -msse -msse2 -m32"
or
CFLAGS="-march=pentium-m -O2 -pipe -fomit-frame-pointer -fweb -ffast-math -mtune=pentium-m -m32"
firefox works fine. So it's not related to either -ffast-math or -mfpmath=sse, but to the combination of the two. This is odd, especially since it seems to indicate the problem is with fontconfig which worked before, and still works for other programs.

Using a self-compiled version of fontconfig I've traced this a bit more, and it seems that it crashes because of a misaligned stack, that is it crashed on a 'movapd' instruction referencing the stack, but the stack was not properly aligned at that address. Also annoying is that it seems that is occasionally does work, since I'm now having trouble reproducing it. Even though I've been recompiling and reprocucing it reliable for some time, it now just seems to keep working...

Anyway, I'm not sure what to do now? Is this bug now invalid, because I use -ffast-math? I'm not sure, because it seems that it might also happen without it, since it crashes because of a misaligned memory access from an sse instruction, which might also happen from -mfpmath=sse alone (it might have 'just worked' on my test, just like I'm having trouble reproducing the issue now). 
Could this be a gcc bug? Google turned up the following bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40838
Comment 5 Thomas Kahle (RETIRED) gentoo-dev 2010-04-11 15:38:46 UTC
Hi again, I will be closing this bug as "invalid" as it does not apply apply to gentoo as a distribution. If you think fontconfig should work fine with your  compiler options you could contact upstream, or gcc upstream. 
I don't know enough about compiler internals to judge here.