From: Oleksii Shevchuk Date: Sat, 3 Nov 2012 19:52:02 +0000 (+0200) Subject: core: interpret \; token in ExecStart as escaped ; X-Git-Tag: v196~72 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=commitdiff_plain;h=7e1a84f55244ca78093b1dabc58683bc0e7f4304 core: interpret \; token in ExecStart as escaped ; Some commands (like 'find') take a semicolon as separate arg. With current parser implementation there is no way to pass one. Patch adds token \; --- diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index 580304417..4dc5c529a 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -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); diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c index bb5cbdf9d..bca8a69b7 100644 --- a/src/test/test-unit-file.c +++ b/src/test/test-unit-file.c @@ -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); }