]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: log syntax error for invalid DefaultInstance=
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 13 Dec 2019 18:25:50 +0000 (19:25 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 16 Dec 2019 13:19:49 +0000 (14:19 +0100)
Ideally, we would want to report this over back over dbus. But that is pretty hard,
because the unitfile parsing logic doesn't provide any feedback.
systemd-analyze verify also doesn't notice the issue, because it doesn't look
at the [Install] section at all. Let's print a message in the logs at least.

TODO
src/shared/install.c

diff --git a/TODO b/TODO
index aded50fee6ab8b56a24f5102d71881ae1e173bae..de560d3f150d21ed057e2f1919ce3dc7478a3830 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1039,6 +1039,7 @@ Features:
   - introduce mix of BindTo and Requisite
   - add a concept of RemainAfterExit= to scope units
   - Allow multiple ExecStart= for all Type= settings, so that we can cover rescue.service nicely
+  - add verification of [Install] section to systemd-analyze verify
 
 * udev-link-config:
    - Make sure ID_PATH is always exported and complete for
index d291eb6f21fe28cae476acd918d552d36a1347cb..0e673b33588f8e824640f322b417b73e9b3bab7b 100644 (file)
@@ -1197,7 +1197,8 @@ static int config_parse_default_instance(
         }
 
         if (!unit_instance_is_valid(printed))
-                return -EINVAL;
+                return log_syntax(unit, LOG_WARNING, filename, line, SYNTHETIC_ERRNO(EINVAL),
+                                  "Invalid DefaultInstance= value \"%s\".", printed);
 
         return free_and_replace(i->default_instance, printed);
 }