Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 724222

Summary: media-plugins/alsa-plugins-1.2.2: Link to 51-pulseaudio-probe.conf should not be relative
Product: Gentoo Linux Reporter: segmentation fault <segmentation-fault>
Component: Current packagesAssignee: Gentoo ALSA team <alsa-bugs>
Status: UNCONFIRMED ---    
Severity: normal CC: 89q1r14hd, jstein, sam
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---

Description segmentation fault 2020-05-20 00:11:17 UTC
The media-plugins/alsa-plugins-1.2.2 ebuild creates a link

/etc/alsa/conf.d/51-pulseaudio-probe.conf

which is a symbolic link to a relative path:

/etc/alsa/conf.d/51-pulseaudio-probe.conf -> ../../../usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf

That the link belongs to this package can be seen with

equery belongs /etc/alsa/conf.d/51-pulseaudio-probe.conf

whose output is:

 * Searching for /etc/alsa/conf.d/51-pulseaudio-probe.conf ... 
media-plugins/alsa-plugins-1.2.2 (/etc/alsa/conf.d/51-pulseaudio-probe.conf -> ../../../usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf)

The problem - i.e. the bug - here is this:

If /etc is itself a symbolic link

/etc -> /some/other/dir/etc

then the relative path above 

../../../usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf

will point to something that does not exist and the output of 'll':

ll /etc/alsa/conf.d/51-pulseaudio-probe.conf
lrwxrwxrwx 1 root root 60 May 14 10:39 /etc/alsa/conf.d/51-pulseaudio-probe.conf -> ../../../usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf

will be in a blinking red color, even if the file

/usr/share/alsa/alsa.conf.d/51-pulseaudio-probe.conf

does exist!


Solution
--------

Create the link with an absolute path, not relative. Or, if you want to avoid problems with absolute paths in symbolic links (these confuse me and my backup scripts sometimes :-)), you should at least find the absolute path of /etc with

readlink /etc

count the levels up to / and set the appropriate number of '../' in the relative link you want to create.

You should not force users to *not* implement their /etc as a symbolic link to somewhere else. I have been using it this way for at least 20 years without problems.
Comment 1 Igor V. Kovalenko 2022-06-19 16:42:03 UTC
You can probably bind-mount your custom /etc if you like.

I do not think a /etc symlink will ever work, there are also make.profile symlink and ssl certificates and maybe other stuff you will have to fight.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2022-06-19 16:47:01 UTC
(In reply to Igor V. Kovalenko from comment #1)
> You can probably bind-mount your custom /etc if you like.
> 
> I do not think a /etc symlink will ever work, there are also make.profile
> symlink and ssl certificates and maybe other stuff you will have to fight.

Yep, and relative symlinks make supporting Prefixes etc a lot easier.