[pulseaudio-discuss] [PATCH v2 1/2] conf-parser: add support for .d directories
Felipe Sateler
fsateler at debian.org
Sat Dec 5 07:24:07 PST 2015
On 4 December 2015 at 09:46, Tanu Kaskinen <tanuk at iki.fi> wrote:
> On Fri, 2015-12-04 at 09:29 -0300, Felipe Sateler wrote:
>> On 4 December 2015 at 02:58, Tanu Kaskinen <tanuk at iki.fi> wrote:
>> > + * If use_dot_d is true, then before parsing the file named by the filename
>> > + * argument, the function will parse all files ending with ".conf" in
>> > + * alphabetical order from a directory whose name is filename + ".d", if such
>> > + * directory exists.
>>
>> This is opposite to how other software (eg systemd) work: first the
>> main file is read, and then the .d/*.conf files are read to override
>> the configurations.
>>
>> So if a distro default has an uncommented line, the .d should override
>> that line. This would allow (in the future) to extend the search path
>> to /usr/share/pulseaudio, and ship the defaults (uncommented) there.
>> Then local configuration can be done via dropin files.
>
> All advice given to users so far has been to modify the main files,
> because nothing else has existed. If users put their changes to the
> main files and distros put their changes to the .d files, that will be
> compatible with existing advice on the internet.
The alternative does not preclude editing the main file either.
Maybe it would be best to step back a bit. Desirable properties for
the configuration loading are (IMO, of course):
1. Any upstream default should be easily overridable by a downstream
distributor.
2. Any upstream/distribution default should be easily overridable by a
local admin.
3. Any upstream/distribution/admin default should be easily
overridable by a local user.
4. Admin overriding a setting should not require writing all the options again.
5. Local user overriding a setting should not require writing all the
options again.
6. Third party packages should be able to provide configuration,
without overriding other options.
7. Local admin/user should be able to override such configuration.
8. Local admin changes to configuration should be clearly visible.
Currently, pulseaudio only covers 1-3. Your proposed patch addresses
point 6, but only in the case the distro default is "everything
commented".
If the load order is inverted, then there is a path to achieving all 8
properties:
- If the dropins were read after the main configuration file, then 6
would be fully addressed.
- If then the path loading is extended to load dropins in the entire
search path, keeping only the highest precedence one, then point 4 and
5 would be addressed.
- If then the loading stops looking at the search path at the first
file with same name found, then point 7 would be addressed.
- And then point 8 can be implemented by shipping the full
configuration file, uncommented, in $datadir. Thus only admin changes
would live in /etc, and local user changes would live in ~/.config.
Not inverting the change, though, makes it cumbersome to provide a
distro default that can be overriden in a package: some arbitrary
prefix should be determined so that packages ship their defaults
ordered after that. This will necessarily be distro-dependent. It also
makes it harder to have properties 4 and 5, since a setting written in
the main file necessarily requires modifying or copying it.
This is the way many other packages work (eg, systemd and dbus), so
people already familiar with that configuration would be surprised by
pa's scheme.
There is a small wrinkle to observe with this load order: if a
package ships a setting in a dropin file, then the user needs to
override that dropin (or ship a new one with a higher ordering) for
his change to work, because the dropin is processed after the main
file. For example, a dropin in /etc that sets autospawn=no, will take
precedence over the main file in ~/.config/pulse that says
autospawn=yes.
This can be addressed by making the dropins from later in the
search path be loaded before the main file being read (eg, a dropin in
/etc would be loaded before reading ~/.config/pulse/client.conf). This
is not done AFAIK in other software; I'm not sure it is a good idea
to deviate.
--
Saludos,
Felipe Sateler
More information about the pulseaudio-discuss
mailing list