Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 724222 - media-plugins/alsa-plugins-1.2.2: Link to 51-pulseaudio-probe.conf should not be relative
Summary: media-plugins/alsa-plugins-1.2.2: Link to 51-pulseaudio-probe.conf should not...
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo ALSA team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-20 00:11 UTC by segmentation fault
Modified: 2022-07-01 06:31 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.