chiark / gitweb /
core: lift restriction on order of - and @ in ExecStart
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Nov 2012 14:25:05 +0000 (15:25 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Nov 2012 15:01:22 +0000 (16:01 +0100)
man/systemd.service.xml
src/core/load-fragment.c
src/test/test-unit-file.c

index 00a6398a1e1ac2adff0dddc36d2e433df5aad60d..8c1dfe18b7292ecb7bbbbf67ebf7dff6c19876d5 100644 (file)
                                 abnormal exit due to signal) is ignored
                                 and considered success. If both
                                 <literal>-</literal> and
-                                <literal>@</literal> are used for the
-                                same command the former must precede
-                                the latter. Unless
+                                <literal>@</literal> are used they
+                                can appear in either order. Unless
                                 <varname>Type=forking</varname> is
                                 set, the process started via this
                                 command line will be considered the
index 4dc5c529a2bcca544c3049c9bc2e89a2b7c5a5e6..b99e70e05a144de8b77f6e72345a83862a1c3e4f 100644 (file)
@@ -438,6 +438,7 @@ int config_parse_exec(
         e += ltype;
 
         for (;;) {
+                int i;
                 char *w;
                 size_t l;
                 char *state;
@@ -452,18 +453,21 @@ int config_parse_exec(
                 if (rvalue[0] == 0)
                         break;
 
-                if (rvalue[0] == '-') {
-                        ignore = true;
-                        rvalue ++;
-                }
+                for (i = 0; i < 2; i++) {
+                        if (rvalue[0] == '-' && !ignore) {
+                                ignore = true;
+                                rvalue ++;
+                        }
 
-                if (rvalue[0] == '@') {
-                        honour_argv0 = true;
-                        rvalue ++;
+                        if (rvalue[0] == '@' && !honour_argv0) {
+                                honour_argv0 = true;
+                                rvalue ++;
+                        }
                 }
 
                 if (*rvalue != '/') {
-                        log_error("[%s:%u] Invalid executable path in command line, ignoring: %s", filename, line, rvalue);
+                        log_error("[%s:%u] Executable path is not absolute, ignoring: %s",
+                                  filename, line, rvalue);
                         return 0;
                 }
 
index bca8a69b7867d3575a84b088dcf13f10bdf5af29..6636b949ea161795b8012987ae3e25a795ce35cc 100644 (file)
@@ -111,6 +111,29 @@ static void test_config_parse_exec(void) {
         check_execcommand(c1,
                           "/RValue/slashes3", "argv0a", "r1", true);
 
+        /* ignore && honour_argv0 */
+        r = config_parse_exec("fake", 4, "section",
+                              "LValue", 0, "@-/RValue///slashes4/// argv0b r1",
+                              &c, NULL);
+        assert_se(r >= 0);
+        c1 = c1->command_next;
+        check_execcommand(c1,
+                          "/RValue/slashes4", "argv0b", "r1", true);
+
+        /* ignore && ignore */
+        r = config_parse_exec("fake", 4, "section",
+                              "LValue", 0, "--/RValue argv0 r1",
+                              &c, NULL);
+        assert_se(r == 0);
+        assert_se(c1->command_next == NULL);
+
+        /* ignore && ignore */
+        r = config_parse_exec("fake", 4, "section",
+                              "LValue", 0, "-@-/RValue argv0 r1",
+                              &c, NULL);
+        assert_se(r == 0);
+        assert_se(c1->command_next == NULL);
+
         /* semicolon */
         r = config_parse_exec("fake", 5, "section",
                               "LValue", 0,