chiark / gitweb /
core: interpret \; token in ExecStart as escaped ;
authorOleksii Shevchuk <alxchk@gmail.com>
Sat, 3 Nov 2012 19:52:02 +0000 (21:52 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 15 Nov 2012 15:01:10 +0000 (16:01 +0100)
Some commands (like 'find') take a semicolon as separate arg. With
current parser implementation there is no way to pass one.

Patch adds token \;

src/core/load-fragment.c
src/test/test-unit-file.c

index 580304417876d0af9ed3881cde6c2507b687ddd8..4dc5c529a2bcca544c3049c9bc2e89a2b7c5a5e6 100644 (file)
@@ -483,6 +483,8 @@ int config_parse_exec(
                 FOREACH_WORD_QUOTED(w, l, rvalue, state) {
                         if (strncmp(w, ";", MAX(l, 1U)) == 0)
                                 break;
+                        else if (strncmp(w, "\\;", MAX(l, 1U)) == 0)
+                                w ++;
 
                         if (honour_argv0 && w == rvalue) {
                                 assert(!path);
index bb5cbdf9d7212852e7b129aebdeaf2e5733cd381..bca8a69b7867d3575a84b088dcf13f10bdf5af29 100644 (file)
@@ -138,6 +138,16 @@ static void test_config_parse_exec(void) {
 
         assert_se(c1->command_next == NULL);
 
+        /* escaped semicolon */
+        r = config_parse_exec("fake", 5, "section",
+                              "LValue", 0,
+                              "/usr/bin/find \\;",
+                              &c, NULL);
+        assert_se(r >= 0);
+        c1 = c1->command_next;
+        check_execcommand(c1,
+                          "/usr/bin/find", "/usr/bin/find", ";", false);
+
         exec_command_free_list(c);
 }