SHA256
1
0
forked from pool/systemd
systemd/0001-conf-parser-introduce-early-drop-ins.patch

356 lines
14 KiB
Diff
Raw Normal View History

From a1c88ab7f5e5ad127833168bbb38340d1b582a88 Mon Sep 17 00:00:00 2001
From: Franck Bui <fbui@suse.com>
Date: Fri, 22 Jan 2021 14:57:08 +0100
Subject: [PATCH 1/1] conf-parser: introduce 'early' drop-ins
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
As formerly known as "downstream conf file drop-ins should never override main
user conf file".
Previously all drop-ins, including those shipped by downstream, shipped in
/usr, could override user's main configuration file (located in /etc) because
the main file was always parsed first.
This was problematic for downstreams because their customization should never
override the users one in general. Therefore the only way to make this logic
usable was by teaching users to never use the main conf files and to put all
theirs settings in drop-ins with a higher priority than the one downsteam would
use. However customizing the defaults through the main conf file is something
very well established since a long time hence this is not something
conceivable.
This patch reworks the way we parse configuration files by introducing "early"
conf files (idea from Zbigniew Jędrzejewski-Szmek), which always have a
priority lower than the main config file and hence other conf file drop-ins
too.
Early conf files can be located in any locations where regular conf snippets
can be installed and are sorted between them using the same sorting rules that
apply to other conf files. A conf file is considered as an early one if its
filename is prefixed with "__" (double underscore).
Hence for example, drop-in "/usr/lib/systemd/logind.conf.d/__99-foo.conf" will
always be parsed before:
/etc/systemd/logind.conf
/etc/systemd/logind.conf.d/00-foo.conf
/usr/lib/systemd/logind.conf.d/00-foo.conf
This change isn't backwards-compatible, but the '__' prefix is something that
is unlikely used. Hence the risk should be very low.
Unfortunately upstream is not seing this problem as a serious one and accept
that vendors' configuration files can take precedence over the main
configuration files (placed in /etc). See the following links for the
related discussions:
https://github.com/systemd/systemd/issues/2121 (initial issue report)
https://github.com/systemd/systemd/pull/17161 (first attempt to solve this issue)
https://github.com/systemd/systemd/pull/18347 (introduction of early drop-in)
Since SUSE heavily relies on drop-ins to customize some of the upstream default
settings, there was no other choice than to diverge from upstream in this
regard.
But it should be noted that these early drop-ins are strictly reserved for SUSE
own purpose only. IOW users should never use them and early drop-ins should
never be created in /etc but only in /usr. We reserve the right to change or
drop this feature at any time.
Fixes: #2121
---
src/shared/conf-parser.c | 54 +++++++++++-
src/test/test-conf-parser.c | 163 ++++++++++++++++++++++++++++++++++++
2 files changed, 213 insertions(+), 4 deletions(-)
diff --git a/src/shared/conf-parser.c b/src/shared/conf-parser.c
index 6bd3ab38db..1722b90ca0 100644
--- a/src/shared/conf-parser.c
+++ b/src/shared/conf-parser.c
@@ -478,6 +478,7 @@ static int hashmap_put_stats_by_path(Hashmap **stats_by_path, const char *path,
static int config_parse_many_files(
Accepting request 902866 from Base:System - Import commit e9a23d9e064c2e7ac21a1b984d116bcf15327e63 8dd19c6ee3 sd-device: allow to read sysattr which contains embedded NUL d52409e5fe pid1: only add a Wants= type dependency on /tmp when PrivateTmp=yes (bsc#1181970 - Import commit fcdb8dce591db2f5fc3c1e3eeb7abe9a2090b401 aa2d840a3b compat-rules: fix warning: "label ‘out’ defined but not used" in path_id_compat.c - Restore 61-persistent-storage-compat.rules that was mistakenly dropped during the merge of v248. - Create /run/lock/subsys again (bsc#1187292) The creation of this directory was mistakenly dropped when 'filesystem' package took the initialization of the generic paths over. Paths under /run/lock are still managed by systemd for lack of better place. - Drop systemd's dependency on udev (jsc#PM-2677) In some environments (i.e. containers) udev is usually not necessary but pulls in unnecessary packages. - Now that chkconfig/insserv are history, let's implement the strict minimum in systemd-sysv-install to enable/disable SysV init scripts (bsc#1186595 bsc#1186359) Indeed there's no much point in dropping SysV support completely until upstream will do especially since 3rd party applications such as vmware still rely on it, see bsc#1186359). - Allow the sysusers config files shipped by systemd rpms to be overriden during system installation (bsc#1171962) - While at it, add a comment to explain why we don't use OBS-URL: https://build.opensuse.org/request/show/902866 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=330
2021-07-01 07:05:27 +02:00
const char* const* conf_files,
+ char **early_files,
char **files,
const char *sections,
ConfigItemLookup lookup,
@@ -496,6 +497,20 @@ static int config_parse_many_files(
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
return -ENOMEM;
}
+ STRV_FOREACH(fn, early_files) {
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ r = config_parse(NULL, *fn, NULL, sections, lookup, table, flags, userdata, &st);
+ if (r < 0)
+ return r;
+ if (r == 0)
+ continue;
+
+ if (ret_stats_by_path) {
+ r = hashmap_put_stats_by_path(&stats_by_path, *fn, &st);
+ if (r < 0)
+ return r;
+ }
+ }
+
Accepting request 902866 from Base:System - Import commit e9a23d9e064c2e7ac21a1b984d116bcf15327e63 8dd19c6ee3 sd-device: allow to read sysattr which contains embedded NUL d52409e5fe pid1: only add a Wants= type dependency on /tmp when PrivateTmp=yes (bsc#1181970 - Import commit fcdb8dce591db2f5fc3c1e3eeb7abe9a2090b401 aa2d840a3b compat-rules: fix warning: "label ‘out’ defined but not used" in path_id_compat.c - Restore 61-persistent-storage-compat.rules that was mistakenly dropped during the merge of v248. - Create /run/lock/subsys again (bsc#1187292) The creation of this directory was mistakenly dropped when 'filesystem' package took the initialization of the generic paths over. Paths under /run/lock are still managed by systemd for lack of better place. - Drop systemd's dependency on udev (jsc#PM-2677) In some environments (i.e. containers) udev is usually not necessary but pulls in unnecessary packages. - Now that chkconfig/insserv are history, let's implement the strict minimum in systemd-sysv-install to enable/disable SysV init scripts (bsc#1186595 bsc#1186359) Indeed there's no much point in dropping SysV support completely until upstream will do especially since 3rd party applications such as vmware still rely on it, see bsc#1186359). - Allow the sysusers config files shipped by systemd rpms to be overriden during system installation (bsc#1171962) - While at it, add a comment to explain why we don't use OBS-URL: https://build.opensuse.org/request/show/902866 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=330
2021-07-01 07:05:27 +02:00
/* First read the first found main config file. */
STRV_FOREACH(fn, conf_files) {
r = config_parse(NULL, *fn, NULL, sections, lookup, table, flags, userdata, &st);
@@ -534,6 +549,27 @@ static int config_parse_many_files(
return 0;
}
+static int config_parse_split_conf_files(char **files, char ***early_files, char ***late_files) {
+
+ assert(files);
+ assert(early_files);
+ assert(late_files);
+
+ STRV_FOREACH(f, files) {
+ char ***s, *p;
+
+ p = strdup(*f);
+ if (!p)
+ return log_oom();
+
+ s = startswith(basename(*f), "__") ? early_files : late_files;
+ if (strv_push(s, p) < 0)
+ return log_oom();
+ }
+
+ return 0;
+}
+
/* Parse each config file in the directories specified as nulstr. */
int config_parse_many_nulstr(
const char *conf_file,
@@ -545,15 +581,19 @@ int config_parse_many_nulstr(
void *userdata,
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
Hashmap **ret_stats_by_path) {
- _cleanup_strv_free_ char **files = NULL;
+ _cleanup_strv_free_ char **files = NULL, **early_files = NULL, **late_files = NULL;
int r;
r = conf_files_list_nulstr(&files, ".conf", NULL, 0, conf_file_dirs);
if (r < 0)
return r;
Accepting request 902866 from Base:System - Import commit e9a23d9e064c2e7ac21a1b984d116bcf15327e63 8dd19c6ee3 sd-device: allow to read sysattr which contains embedded NUL d52409e5fe pid1: only add a Wants= type dependency on /tmp when PrivateTmp=yes (bsc#1181970 - Import commit fcdb8dce591db2f5fc3c1e3eeb7abe9a2090b401 aa2d840a3b compat-rules: fix warning: "label ‘out’ defined but not used" in path_id_compat.c - Restore 61-persistent-storage-compat.rules that was mistakenly dropped during the merge of v248. - Create /run/lock/subsys again (bsc#1187292) The creation of this directory was mistakenly dropped when 'filesystem' package took the initialization of the generic paths over. Paths under /run/lock are still managed by systemd for lack of better place. - Drop systemd's dependency on udev (jsc#PM-2677) In some environments (i.e. containers) udev is usually not necessary but pulls in unnecessary packages. - Now that chkconfig/insserv are history, let's implement the strict minimum in systemd-sysv-install to enable/disable SysV init scripts (bsc#1186595 bsc#1186359) Indeed there's no much point in dropping SysV support completely until upstream will do especially since 3rd party applications such as vmware still rely on it, see bsc#1186359). - Allow the sysusers config files shipped by systemd rpms to be overriden during system installation (bsc#1171962) - While at it, add a comment to explain why we don't use OBS-URL: https://build.opensuse.org/request/show/902866 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=330
2021-07-01 07:05:27 +02:00
- return config_parse_many_files(STRV_MAKE_CONST(conf_file),
- files, sections, lookup, table, flags, userdata,
+ r = config_parse_split_conf_files(files, &early_files, &late_files);
+ if (r < 0)
+ return r;
+
Accepting request 902866 from Base:System - Import commit e9a23d9e064c2e7ac21a1b984d116bcf15327e63 8dd19c6ee3 sd-device: allow to read sysattr which contains embedded NUL d52409e5fe pid1: only add a Wants= type dependency on /tmp when PrivateTmp=yes (bsc#1181970 - Import commit fcdb8dce591db2f5fc3c1e3eeb7abe9a2090b401 aa2d840a3b compat-rules: fix warning: "label ‘out’ defined but not used" in path_id_compat.c - Restore 61-persistent-storage-compat.rules that was mistakenly dropped during the merge of v248. - Create /run/lock/subsys again (bsc#1187292) The creation of this directory was mistakenly dropped when 'filesystem' package took the initialization of the generic paths over. Paths under /run/lock are still managed by systemd for lack of better place. - Drop systemd's dependency on udev (jsc#PM-2677) In some environments (i.e. containers) udev is usually not necessary but pulls in unnecessary packages. - Now that chkconfig/insserv are history, let's implement the strict minimum in systemd-sysv-install to enable/disable SysV init scripts (bsc#1186595 bsc#1186359) Indeed there's no much point in dropping SysV support completely until upstream will do especially since 3rd party applications such as vmware still rely on it, see bsc#1186359). - Allow the sysusers config files shipped by systemd rpms to be overriden during system installation (bsc#1171962) - While at it, add a comment to explain why we don't use OBS-URL: https://build.opensuse.org/request/show/902866 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=330
2021-07-01 07:05:27 +02:00
+ return config_parse_many_files(STRV_MAKE_CONST(conf_file), early_files, late_files,
+ sections, lookup, table, flags, userdata,
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
ret_stats_by_path);
}
@@ -590,6 +630,7 @@ int config_parse_many(
void *userdata,
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
Hashmap **ret_stats_by_path) {
+ _cleanup_strv_free_ char **early_files = NULL, **late_files = NULL;
_cleanup_strv_free_ char **files = NULL;
int r;
@@ -602,7 +643,12 @@ int config_parse_many(
if (r < 0)
return r;
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
- return config_parse_many_files(conf_files, files, sections, lookup, table, flags, userdata, ret_stats_by_path);
+ r = config_parse_split_conf_files(files, &early_files, &late_files);
+ if (r < 0)
+ return r;
+
Accepting request 902866 from Base:System - Import commit e9a23d9e064c2e7ac21a1b984d116bcf15327e63 8dd19c6ee3 sd-device: allow to read sysattr which contains embedded NUL d52409e5fe pid1: only add a Wants= type dependency on /tmp when PrivateTmp=yes (bsc#1181970 - Import commit fcdb8dce591db2f5fc3c1e3eeb7abe9a2090b401 aa2d840a3b compat-rules: fix warning: "label ‘out’ defined but not used" in path_id_compat.c - Restore 61-persistent-storage-compat.rules that was mistakenly dropped during the merge of v248. - Create /run/lock/subsys again (bsc#1187292) The creation of this directory was mistakenly dropped when 'filesystem' package took the initialization of the generic paths over. Paths under /run/lock are still managed by systemd for lack of better place. - Drop systemd's dependency on udev (jsc#PM-2677) In some environments (i.e. containers) udev is usually not necessary but pulls in unnecessary packages. - Now that chkconfig/insserv are history, let's implement the strict minimum in systemd-sysv-install to enable/disable SysV init scripts (bsc#1186595 bsc#1186359) Indeed there's no much point in dropping SysV support completely until upstream will do especially since 3rd party applications such as vmware still rely on it, see bsc#1186359). - Allow the sysusers config files shipped by systemd rpms to be overriden during system installation (bsc#1171962) - While at it, add a comment to explain why we don't use OBS-URL: https://build.opensuse.org/request/show/902866 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=330
2021-07-01 07:05:27 +02:00
+ return config_parse_many_files(conf_files, early_files, late_files,
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ sections, lookup, table, flags, userdata, ret_stats_by_path);
}
static int config_get_stats_by_path_one(
diff --git a/src/test/test-conf-parser.c b/src/test/test-conf-parser.c
index e61932ab16..5a5c0d73ff 100644
--- a/src/test/test-conf-parser.c
+++ b/src/test/test-conf-parser.c
@@ -5,6 +5,9 @@
#include "fs-util.h"
#include "log.h"
#include "macro.h"
+#include "mkdir.h"
+#include "path-util.h"
+#include "rm-rf.h"
#include "string-util.h"
#include "strv.h"
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
#include "tests.h"
@@ -391,4 +394,164 @@ TEST(config_parse) {
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
test_config_parse_one(i, config_file[i]);
}
+static void setup_conf_files(const char *root, bool is_main, char **conf_files, char ***ret_conf_dirs) {
+
+ /* If 'is_main' is true then 'conf_files' should only contain an entry
+ * for the main conf file. */
+ if (is_main)
+ assert_se(strv_length(conf_files) <= 1);
+
+ STRV_FOREACH(path, conf_files) {
+ _cleanup_free_ char *abspath = NULL;
+ _cleanup_fclose_ FILE *f = NULL;
+
+ abspath = path_join(root, *path);
+ assert_se(abspath);
+
+ (void) mkdir_parents(abspath, 0755);
+
+ f = fopen(abspath, "w");
+ assert_se(f);
+ fprintf(f,
+ "[Section]\n"
+ "name=%s\n",
+ *path);
+
+ if (!is_main)
+ fprintf(f,
+ "%s=%s\n",
+ startswith(basename(*path), "__") ? "early" : "late",
+ *path);
+
+ if (ret_conf_dirs) {
+ char *d;
+
+ assert_se((d = dirname_malloc(abspath)));
+ assert_se(strv_push(ret_conf_dirs, d) == 0);
+ }
+ }
+
+ if (ret_conf_dirs) {
+ strv_uniq(*ret_conf_dirs);
+ strv_sort(*ret_conf_dirs);
+ }
+}
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+static void test_config_parse_many_nulstr_one(bool nulstr, const char *main, char **conf_files,
+ const char *name, const char *early, const char *late) {
+
+ _cleanup_free_ char *parsed_name = NULL, *parsed_early = NULL, *parsed_late = NULL;
+ _cleanup_strv_free_ char **conf_dirs = NULL;
+ _cleanup_free_ char *conf_dirs_nulstr = NULL;
+ char *conf_file;
+ char *tmp_dir;
+ size_t size;
+ int r;
+
+ const ConfigTableItem items[] = {
+ { "Section", "name", config_parse_string, 0, &parsed_name},
+ { "Section", "late", config_parse_string, 0, &parsed_late},
+ { "Section", "early", config_parse_string, 0, &parsed_early},
+ };
+
+ tmp_dir = strdupa("/tmp/test-conf-parser-XXXXXX");
+ assert_se(mkdtemp(tmp_dir));
+
+ setup_conf_files(tmp_dir, true, STRV_MAKE(main), NULL);
+ setup_conf_files(tmp_dir, false, conf_files, &conf_dirs);
+
+ conf_file = main ? strjoina(tmp_dir, "/", main) : NULL;
+
+ if (nulstr) {
+ r = strv_make_nulstr(conf_dirs, &conf_dirs_nulstr, &size);
+ assert_se(r == 0);
+
+ r = config_parse_many_nulstr(conf_file, conf_dirs_nulstr,
+ "Section\0",
+ config_item_table_lookup, items,
+ CONFIG_PARSE_WARN,
+ NULL,
+ NULL);
+ } else {
+ /* sigh... since commit bdb2d3c6889408c7f26c2eeddbe9021ac53f962c,
+ * 'conf_file_dirs' parameter can't be NULL. */
+
Accepting request 902866 from Base:System - Import commit e9a23d9e064c2e7ac21a1b984d116bcf15327e63 8dd19c6ee3 sd-device: allow to read sysattr which contains embedded NUL d52409e5fe pid1: only add a Wants= type dependency on /tmp when PrivateTmp=yes (bsc#1181970 - Import commit fcdb8dce591db2f5fc3c1e3eeb7abe9a2090b401 aa2d840a3b compat-rules: fix warning: "label ‘out’ defined but not used" in path_id_compat.c - Restore 61-persistent-storage-compat.rules that was mistakenly dropped during the merge of v248. - Create /run/lock/subsys again (bsc#1187292) The creation of this directory was mistakenly dropped when 'filesystem' package took the initialization of the generic paths over. Paths under /run/lock are still managed by systemd for lack of better place. - Drop systemd's dependency on udev (jsc#PM-2677) In some environments (i.e. containers) udev is usually not necessary but pulls in unnecessary packages. - Now that chkconfig/insserv are history, let's implement the strict minimum in systemd-sysv-install to enable/disable SysV init scripts (bsc#1186595 bsc#1186359) Indeed there's no much point in dropping SysV support completely until upstream will do especially since 3rd party applications such as vmware still rely on it, see bsc#1186359). - Allow the sysusers config files shipped by systemd rpms to be overriden during system installation (bsc#1171962) - While at it, add a comment to explain why we don't use OBS-URL: https://build.opensuse.org/request/show/902866 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=330
2021-07-01 07:05:27 +02:00
+ r = config_parse_many(STRV_MAKE_CONST(conf_file),
+ (const char * const*)(conf_dirs ?: STRV_MAKE_EMPTY),
+ "",
+ "Section\0",
+ config_item_table_lookup, items,
+ CONFIG_PARSE_WARN,
+ NULL,
+ NULL);
+ }
+
+ assert_se(r == 0);
+
+ assert_se((!!name == !!parsed_name));
+ assert_se(!name || streq(name, parsed_name));
+
+ assert_se((!!late == !!parsed_late));
+ assert_se(!late || streq(late, parsed_late));
+
+ assert_se((!!early == !!parsed_early));
+ assert_se(!early || streq(early, parsed_early));
+
+ assert_se(rm_rf(tmp_dir, REMOVE_ROOT|REMOVE_PHYSICAL) == 0);
+}
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+static void test_config_parse_many_nulstr(bool nulstr) {
Accepting request 879358 from Base:System - Import commit 9753d1c17545a5d46530696cb14254f5f12024f1 (merge of v246.11) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/134cf1c8bc3e361a2641161aa11ac2b5b990480b...9753d1c17545a5d46530696cb14254f5f12024f1 - Rebase 0001-conf-parser-introduce-early-drop-ins.patch - Import commit 13bc08870147b35f87cefb074aec22e767b7ac04 846d61e0a1 boot: Move console declarations to missing_efi.h 171a37228b boot: Add startswith() and endswith() functions with no_case variants 0fad9f309a boot: Drop unnecessary braces c38bbb0874 boot: Fix void pointer arithmetic warning 438210924b boot: Replace raw efivar gets with typed variants e46cb3e4a0 boot: Add efivar_get/set_uint64_le() functions e16bee35c8 boot: Rename efivar_get/set_int() to efivar_get/set_uint_string() 2808d0e9a3 boot: Tighten scope of variables used in loops d3f3d57743 boot: Add efivar_get_boolean_u8() 0551ecce71 boot: Make all efivar util functions take the guid as an argument 8376ba3b9f boot: Turn all guid constants into C99 compound initializers 166fc2dad2 boot: Enable C99 c87d66e261 boot: Move Secure Boot logic to new file da7bba9438 udev: fix memleak e06139117c nspawn: make rootfs relative to oci bundle path (bsc#1182598) 8ba587d46c PATCH] Always free deserialized_subscribed on reload (bsc#1180020) - Make sure the udev socket units are reloaded during udev package updates - fix-machines-btrfs-subvol.sh is only shipped when machined is built OBS-URL: https://build.opensuse.org/request/show/879358 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=327
2021-03-17 20:14:01 +01:00
+ log_info("== %s%s ==", __func__, nulstr ? "_nulstr" : "");
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr, NULL, NULL, NULL, NULL, NULL);
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ "dir/main.conf", NULL,
+ "dir/main.conf", NULL, NULL);
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ NULL, STRV_MAKE("dir1/50-foo.conf"),
+ "dir1/50-foo.conf", NULL, "dir1/50-foo.conf");
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ NULL, STRV_MAKE("dir1/__50-foo.conf"),
+ "dir1/__50-foo.conf", "dir1/__50-foo.conf", NULL);
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ NULL, STRV_MAKE("dir1/10-foo.conf", "dir1/50-bar.conf"),
+ "dir1/50-bar.conf", NULL, "dir1/50-bar.conf");
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ NULL, STRV_MAKE("dir1/50-foo.conf", "dir2/10-bar.conf"),
+ "dir1/50-foo.conf", NULL, "dir1/50-foo.conf");
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ NULL, STRV_MAKE("dir1/10-foo.conf", "dir2/10-foo.conf"),
+ "dir1/10-foo.conf", NULL, "dir1/10-foo.conf");
+
+ /* Early conf files should never override the main one whatever their
+ * priority/location. */
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ "dir/10-main.conf",
+ STRV_MAKE("dir1/__10-foo.conf", "dir2/__99-foo.conf"),
+ "dir/10-main.conf", "dir2/__99-foo.conf", NULL);
+
+ /* Late conf files always take precendence over the early conf files
+ * and the main one. */
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+ test_config_parse_many_nulstr_one(nulstr,
+ "dir/50-main.conf", STRV_MAKE("dir1/10-foo.conf"),
+ "dir1/10-foo.conf", NULL, "dir1/10-foo.conf");
+
+ test_config_parse_many_nulstr_one(nulstr,
+ "dir/10-main.conf",
+ STRV_MAKE("dir1/__10-foo.conf", "dir2/__99-foo.conf",
+ "dir2/10-foo.conf"),
+ "dir2/10-foo.conf", "dir2/__99-foo.conf", "dir2/10-foo.conf");
+}
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
+TEST(config_parse_many) {
+ test_config_parse_many_nulstr(true);
+ test_config_parse_many_nulstr(false);
+}
+
Accepting request 964674 from Base:System - spec: cope with %{_modprobedir} being /lib/modprobe.d on SLE - Add 1000-Revert-getty-Pass-tty-to-use-by-agetty-via-stdin.patch A temporary workaround until bsc#1197178 is resolved. - Import commit 8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 (merge of v250.4) For a complete list of changes, visit: https://github.com/openSUSE/systemd/compare/ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a...8ef8dfd5401ba18caec59e54a05af9f2e0d7ac65 - Import commit ca89b1d1fd1ae86cc1e763d2d01ec2806f3a4d3a 37b683c832 journal: preserve acls when rotating user journals with NOCOW attribute set d043fabebc journal: when copying journal file to undo NOCOW flag, go via fd 78c2766689 journal-file: explicitly handle file systems that do not support hole punching 7ecfb4b098 journal-file: fix error handling of pread() in journald_file_punch_holes() c4946a412c journal-file: don't use pread() when determining where to append, use mmap as before d3fbd20628 journal: various fixes to journal_file_read_object() 5897a8e8d4 shared: Handle filesystems that don't support hole punching in COPY_HOLES 27746408e2 journal: Truncate file instead of punching hole in final object 59b6130030 shared: Ensure COPY_HOLES copies trailing holes ac9ccba73f journal: stat journal file after truncating 0257283444 journal: Copy holes when archiving BTRFS journal files 26c2a9952d shared: Copy holes in sparse files in copy_bytes_full() 6c7191dece copy: fix wrong argument passed to S_ISREG() in copy_file_fd_full() af0a43024d udev: 60-persistent-storage-tape.rules: handle duplicate device ID (bsc#1195529) - Update Supplements to new format in baselibs.conf - Fix libsystemd-shared exclusion in baselibs.conf - Exclude new cryptsetup libraries in baselibs.conf - systemd.spec: minor simplification by assuming that %{bootstrap} is always OBS-URL: https://build.opensuse.org/request/show/964674 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=354
2022-03-28 16:58:41 +02:00
DEFINE_TEST_MAIN(LOG_INFO);
--
2.35.3