Bug#742388: libpulse0: spurious files .pulse and .pulse-cookie in /root directory

Frank Heckenbach f.heckenbach at fh-soft.de
Sun Mar 23 03:26:40 UTC 2014


Package: libpulse0
Version: 2.0-6.1
Severity: normal
Tags: patch

I noticed that the following files and directory keep appearing in
my /root directory even after I remove them and even if root is not
logged in:

/root/.pulse-cookie
/root/.pulse
/root/.pulse/blahblah-runtime -> /tmp/pulse-blah

In particular, they appear during system boot, and when hot-plugging
a (USB) audio device.

The latter obviously made udev suspicious, and debugging revealed
that it calls "alsactl restore" with HOME unset.

Then alsactl, more precisely libpulse0 which it uses, in function
pa_get_home_dir(), finds that HOME is not set and retrieves the root
user's home directory (/root) via getpwuid().

AFAIK that's wrong! /root is meant for root-as-a-user, i.e. when
logged in as root, not for daemons which run with root permissions.

It also doesn't seem to make much sense: These files are apparently
there to find some data for pulse. But pulse runs per-user (and its
home page severly warns against running in system mode), so these
files under /root are probably never seen and used at all.

Maybe the core of the problem is that different developers are
unclear about the role of alsactl and/or libpulse0. (a) Their own
developers may think they're user programs (so HOME should always be
set), but (b) udev developers apparently think it's OK to call them
from a daemon (so HOME is not set).

If (a) is correct, udev must not call alsactl without HOME set.

If (b) is correct, libpulse0 must accept when HOME is not set, and
not try to set it via getpwuid(), and in this case not create those
files and directory at all (if they're pointless anyway) or put them
somewhere under /run.

Work-around:

Even though I'd tend to think (b) is correct, a quick fix is easier
with (a), so I go with that for now. (In the end it must be sorted
out between those developers.)

Instead of setting HOME, this patch sets USERPROFILE (for a more
localized change), which pa_get_home_dir() checks after HOME and
before using getpwuid():

--- 90-alsa-restore.rules
+++ 90-alsa-restore.rules
@@ -1,2 +1,2 @@
 ACTION=="add", SUBSYSTEM=="sound", KERNEL=="controlC*", KERNELS=="card*", \
-        TEST=="/usr/sbin/alsactl", RUN+="/usr/sbin/alsactl restore $attr{number}"
+        TEST=="/usr/sbin/alsactl", ENV{USERPROFILE}="/run/pulseaudio", RUN+="/usr/sbin/alsactl restore $attr{number}"

Note: With this patch, it actually doesn't create those files at all
because /run/pulseaudio doesn't exist. That seems fine to me, since
these files apparently serve no purpose anyway, see above. If you
want them, just create this directory in some init or wrapper
script. (I've tested both cases.)

-- System Information:
Debian Release: 7.4
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'stable')
Architecture: i386 (i686)



More information about the pkg-pulseaudio-devel mailing list