[bluez/bluez] 5567c2: Support for config fragments (conf.d style dirs)

From: Manuel A. Fernandez Montecelo <hidden>
Date: 2026-01-15 02:55:03

  Branch: refs/heads/1042572
  Home:   https://github.com/bluez/bluez
  Commit: 5567c2249c4a13d054eb3f117f1c51584dbb7df0
      https://github.com/bluez/bluez/commit/5567c2249c4a13d054eb3f117f1c51584dbb7df0
  Author: Manuel A. Fernandez Montecelo [off-list ref]
  Date:   2026-01-15 (Thu, 15 Jan 2026)

  Changed paths:
    M Makefile.am
    M profiles/input/hog.c
    M profiles/input/manager.c
    M profiles/network/manager.c
    A src/conf_d.c
    A src/conf_d.h
    M src/main.c

  Log Message:
  -----------
  Support for config fragments (conf.d style dirs)

Support config fragments, to read config from conf.d directories.
Those dirs will be main.conf.d for main.conf, analog for input.conf
and network.conf.

This is commonly supported by other tools, as an extension of the main
config file(s).  It is useful and convenient in several situations,
for example:

* distributions can set different values from the defaults shipped
  upstream, without having to modify the config file

* different packages or config-management tools can change config just
  by adding, removing or modifying files in that directory; instead of
  editing the main config files

The main or base config files will be processed first, and then files
in the corresponding conf.d dirs, if existing.

When reading these config files in conf.d dirs, they override values
for keys in the base config files (or default config set in code).
For example, for "main.conf" the directory to be processed will be
"main.conf.d", in the same basedir as the config file
(e.g. /etc/bluetooth/main.conf, /etc/bluetooth/main.conf.d/).  The
same for input.conf and network.conf.

Within the conf.d directory, the format of the filename should be
'^([0-9][0-9])-([a-zA-Z0-9-_])*\.conf$', that is, starting with "00-"
to "99-", ending in ".conf", and with a mix of alphanumeric characters
with dashes and underscores in between.  For example:
'01-override-general-secureconnections.conf'.

Files with a different name scheme will not be considered.  Accepting
groups or keys not present in the base config depends on the code,
currently set to "NOT accept new groups" but "YES to accept new keys".
This is because the base config files as shipped contain all the
groups, but most keys are commented-out, with the default values set
in code.

The candidate files within the given directory are sorted (with
g_strcmp0(), so the ordering will be as with strcmp()).  The
configuration in the files being processed later will override
previous config, in particular the main/base config files, but also
the one from previous files processed, if the Group and Key coincide.

For example, consider 'main.conf' that contains the defaults:

  [General]
  DiscoverableTimeout=0
  PairableTimeout=0

and there is a file 'main.conf.d/70-default-timeouts-vendor.conf'
containing settings for these keys:

  [General]
  DiscoverableTimeout=30
  PairableTimeout=30

and another 'main.conf.d/99-default-timeouts-local.conf'
containing settings only for 'PairableTimeout':

  [General]
  PairableTimeout=15

What happens is:
1) First, the 'main.conf' is processed as usual;
2) then 'main.conf.d/70-default-timeouts-vendor.conf' is processed,
   overriding the two values from the main config file with the given
   values;
3) and finally 'main.conf.d/99-default-timeouts-local.conf' is
   processed, overriding once again only 'PairableTimeout'.

The final, effective values are:

  DiscoverableTimeout=30
  PairableTimeout=15



To unsubscribe from these emails, change your notification settings at https://github.com/bluez/bluez/settings/notifications
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help