Root ownership on /tmp/pulse-$USER (a warning to packagers)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

This is a little story that I've only just recently fully appreciated....

As with many distro's I've repackaged esound such that the actual binary
is distributed separately and as such pulse can be installed with it's
/usr/bin/esdcompat script symlinked to /usr/bin/esd.

Anyway, while doing this packaging, I inadvertently omitted the
/etc/esd.conf file. This turned out to be a very subtle mistake which
I'll eventually outline.


Now, thanks to bug #215 (http://www.pulseaudio.org/ticket/215) on some
systems, the root environment when accessed via "su" (as opposed to "su
-") will cause $USER to be the old username and *not* "root". When a
pulse client is run, this caused /tmp/pulse-colin to become owned by
root which then stopped pulse clients started by the user from running. Urk.

In some circumstances this would happen seemingly automatically even if
you don't run any apps that seemed to use sound? Very confusing.

So I worked around #215 in Mandriva by swapping the order of the env
vars to check $USERNAME first. This worked great and stopped the
ownership being set to root. Ace.

But then came a second problem. It seems that sometimes a pulseaudio
daemon process was found lurking on the system seemingly started by
root. WTF? This also interfered with the user's pulseaudio daemon in
some circumstances (e.g. if root's had opened the sound device the
user's couldn't).

Anyway, to cut a long story short, I eventually found that it was
actually libesound that was starting this process. If you run an
application as root (e.g. firestarter - a gtk firewall thingy) that used
libesound it would go through some code that checked for the existence
of /etc/esd.conf. If this file did not exist, the bahaviour is such that
the library will try to *autospawn "esd" by default*. This is in
contrast to the default esd.conf shipped with esound which has
auto_spawn=0 specified in it. Go figure!

So to fix this problem I simply ship an /etc/esd.conf with the
pulseaudio-esound-compat package. The alternative is to patch libesound
to not do the auto spawn by default thing but this seemed cleaner.

I hope this helps someone not go insane as I nearly did :)

Take care

Col




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux