Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 752387 - www-client/firefox-78: Enabling pulseaudio USE flag should give a message that ALSA will not work with firefox 78
Summary: www-client/firefox-78: Enabling pulseaudio USE flag should give a message tha...
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Mozilla Gentoo Team
Depends on:
Reported: 2020-11-02 21:46 UTC by segmentation fault
Modified: 2020-12-07 15:23 UTC (History)
1 user (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description segmentation fault 2020-11-02 21:46:03 UTC
I merged firefox 78.4.0 and, for the first time, I enabled the pulseaudio USE flag. According to the output of

equery uses firefox

this means: "Add support for PulseAudio sound server".

Now, to me, this means "Compile Firefox in a way that it CAN work with PulseAudio, IF IT IS THERE". I was more than upset to read in the ebuild that this is not the case:

    mozconfig_use_enable pulseaudio
    # force the deprecated alsa sound code if pulseaudio is disabled
    if use kernel_linux && ! use pulseaudio ; then
        mozconfig_add_options_ac '-pulseaudio' --enable-alsa

The ebuild uses the pulseaudio USE flag in a way that it changes its standard semantics above. The way it is used in the ebuild means: 

Compile Firefox in a way that it will NOT work if you DON'T have PulseAudio!

I had always thought that "enable support for X" means "you don't have to have X, but IF you have it, we WILL support it!". So I thought that, although I do have PulseAudio merged in my system, I don't have to start the PulseAudio server to use Firefox - ALSA would still work, as it had in the past with "-pulseaudio".

Not only Firefox will NOT work without a running PulseAudio now, it will also crash on every page that contains a video with audio or audio! And, even worse, being the piece of crap that it has become in these days, Firefox will vomit just cryptic messages like

OpenCubeb() failed to init cubeb: file ...dom/media/AudioStream.cpp, line 331
WARNING: Decoder=7fcc09adc400 [OnMediaSinkAudioError]: file ...dom/media/MediaDecoderStateMachine.cpp, line 3891
WARNING: Decoder=7f4f61dd9c00 Decode error: NS_ERROR_DOM_MEDIA_MEDIASINK_ERR (0x806e000b) - OnMediaSinkAudioError: file ...dom/media/MediaDecoderStateMachine.cpp, line 3470

instead of just saying "hey, I cannot find the PulseAudio server, maybe you forgot to start it?". Crappy, indeed...

What you should do as ebuild developer(s) is add a message like this:

"You enabled the pulseaudio flag. This means that support for ALSA (which is deprecated in Firefox) was not added in the build - you MUST start the PulseAudio server to use Firefox on pages with video+audio or audio alone."

Of course, a properly coded product will not just crash if some server is not running, but will give a meaningful error and continue to work with the rest of its functionality - but "graceful degradation" is unknown to the incompetent developers of Firefox today - not your fault.

Please add such a message to save at least some our nerves that have been treated so badly the last years by this once-so-shiny-but-now-so-crappy software.

Thank you

Reproducible: Always

Steps to Reproduce:
1. Merge Firefox with the pulseaudio USE flag.
2. Do NOT start PulseAudio server.
3. Visit some site with video+audio.
Actual Results:  
4. Mozilla crashed. You suck! (You thought you would avoid that by imposing a "Good example" on us? A good example is of no use if the software is crap! :-))

Expected Results:  
Graceful degradation instead of hard crashes.

Some info:

Portage 2.3.99 (python 3.7.7-final-0, default/linux/amd64/17.0/hardened, gcc-9.3.0, glibc-2.30-r8, 4.19.81-gentoo x86_64)
System uname: Linux-4.19.81-gentoo-x86_64-Intel-R-_Core-TM-_i7-6700HQ_CPU_@_2.60GHz-with-gentoo-2.6
KiB Mem:    XXXXXX total,  YYYYYY free
KiB Swap:   PPPPPP total,  QQQQQQ free
Timestamp of repository gentoo: Mon, 11 May 2020 00:45:01 +0000
sh bash 5.0_p17
ld GNU ld (Gentoo 2.33.1 p2) 2.33.1
app-shells/bash:          5.0_p17::gentoo
dev-java/java-config:     2.2.0-r4::gentoo
dev-lang/perl:            5.30.1::gentoo
dev-lang/python:          2.7.18::gentoo, 3.6.10-r2::gentoo, 3.7.7-r2::gentoo, 3.8.2-r2::gentoo
dev-util/cmake:           3.16.5::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.6-r1::gentoo
sys-apps/openrc:          0.42.1::gentoo
sys-apps/sandbox:         2.13::gentoo
sys-devel/autoconf:       2.13-r1::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.11.6-r3::gentoo, 1.12.6::gentoo, 1.13.4-r2::gentoo, 1.14.1::gentoo, 1.15.1-r2::gentoo, 1.16.1-r1::gentoo
sys-devel/binutils:       2.33.1-r1::gentoo
sys-devel/gcc:            7.3.0-r3::gentoo, 7.4.0-r2::gentoo, 7.5.0::gentoo, 8.3.0-r1::gentoo, 9.2.0-r2::gentoo, 9.3.0::gentoo
sys-devel/gcc-config:     2.2.1::gentoo
sys-devel/libtool:        2.4.6-r6::gentoo
sys-devel/make:           4.2.1-r4::gentoo
sys-kernel/linux-headers: 5.4::gentoo (virtual/os-headers)
sys-libs/glibc:           2.30-r8::gentoo
Comment 1 Ionen Wolkens gentoo-dev 2020-11-03 00:23:18 UTC
Technically alsa would work with USE=pulseaudio if you emerge apulse, and I'd argue it's the preferred way to use alsa with firefox because upstream hardly care to keep the native support in good shape (and will probably get removed entirely eventually).

Firefox also has poor support for choosing output at runtime, at the base it expects you to use pulseaudio and nothing else (especially if built with it).
Comment 2 segmentation fault 2020-11-03 01:41:54 UTC
Thanks for answering.

Before upgrading to 78, I had 68.8.0 and don't remember to have had problems like this. My intention in writing this bug was to urge you to print some advice in the messages that appear after installation of a package. You can choose to do it in case one has disabled pulseaudio, or enabled it - or, probably better, both. Otherwise, how is one supposed to know what the "preferred way" is?

Actually (and this has nothing to do with Gentoo or the ebuild), I have an aversion for software that fails so miserably on tasks so fundamental like "audio" or "video" and requires me to install extra software I wouldn't otherwise use - so I guess I'll take a notice of my open tabs in Firefox (as it currently spends more time crashing than doing useful work) and ditch it altogether.

My main browser for daily use is PaleMoon anyway, so I will not miss anything - because (guess what) PaleMoon Just Works(TM)... :-)
Comment 3 Esteve Varela Colominas 2020-12-07 15:23:57 UTC
The exact semantics of USE flags like this aren't really defined. While most software does indeed still have an ALSA code path when built with USE=pulseaudio, that's not necessarily the case. Take note of all the software that merges apulse[sdk] instead of pulseaudio when the flag is disabled nowadays, for example. Those don't work without some form of pulseaudio library either, anymore.

I think this is a more general Gentoo issue, since flags like "sdl" can also mean things like "prefer sdl-mixer instead of gtk for audio" or "build an sdl frontend", but I'm not sure how it'd be solved without creating a bunch of new and sometimes arbitrary USE flags.