mk-fg / python-pulse-control

Python high-level interface and ctypes-based bindings for PulseAudio (libpulse)
https://pypi.org/project/pulsectl/
MIT License
170 stars 36 forks source link

tests: pass $HOME to pulseaudio to avoid weird cookie paths #59

Closed sbraz closed 3 years ago

sbraz commented 3 years ago

Hi again, Without this, pulseaudio tries to start with a cookie in the home directory defined in passwd, preventing it to start in some cases.

One example of this is the Gentoo portage sandbox. When $HOME is unset, it attempts to create a cookie in a path where it has no write access:

W: [pulseaudio] authkey.c: Failed to open cookie file '/var/lib/portage/home/.config/pulse/cookie': No such file or directory                                                                                     

The sandbox explicitly sets $HOME so that the code running inside it can place its files there. It would be nice if you could keep this environment variable. If not, we will have to keep that patch with the Gentoo package.

mk-fg commented 3 years ago

Thanks.

Iirc there's also a problem with such tests using daemon.conf from /etc, which can have user stuff in it potentially messing-up tests (like system mode, I think?), but not sure how to override that one in pulse, though didn't look too hard either. Might not be a problem with a sandboxed environment though, if filesystem namespaces are used there anyway.

sbraz commented 3 years ago

I am actually using the system mode and it's not breaking my test suite :)

Thanks for the merge, will you release a new version soonish or should I backport it while I add the package to Gentoo?

EDIT: oh nevermind I see you are in the process of doing so :)

mk-fg commented 3 years ago

Yeah, I usually just run twine to update pypi after any commits that change something non-irrelevant, can forget sometimes though :)