]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: warn about unkown sections in unit files 14111/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 22 Nov 2019 10:59:11 +0000 (11:59 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 25 Nov 2019 15:45:29 +0000 (16:45 +0100)
As in the previous commit, ignoring unkown sections means users may be confused
easily. It is better to warn about misspellt section names.

In this case, we are using a separate item table, so we'd ignore all those
sections anyway, so we could list them with out the minus prefixes and the
effect would be the same. But I think it's clearer to prefix them.

src/shared/install.c

index 14dfd331d584a0f5ded6c70ed4a8f50640124053..56806609280533821e82defcfabf2976a851f8dd 100644 (file)
@@ -1290,9 +1290,21 @@ static int unit_file_load(
         assert(c);
 
         r = config_parse(info->name, path, f,
-                         NULL,
+                         "Install\0"
+                         "-Unit\0"
+                         "-Automount\0"
+                         "-Device\0"
+                         "-Mount\0"
+                         "-Path\0"
+                         "-Scope\0"
+                         "-Service\0"
+                         "-Slice\0"
+                         "-Socket\0"
+                         "-Swap\0"
+                         "-Target\0"
+                         "-Timer\0",
                          config_item_table_lookup, items,
-                         CONFIG_PARSE_RELAXED|CONFIG_PARSE_ALLOW_INCLUDE, info);
+                         CONFIG_PARSE_ALLOW_INCLUDE, info);
         if (r < 0)
                 return log_debug_errno(r, "Failed to parse %s: %m", info->name);