From 252549990ffb94da3165e1123952ef7075894f5e Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Wed, 17 Feb 2016 22:20:56 +0000 Subject: tests: add test for https://github.com/systemd/systemd/issues/2637 + perl -e 'exit(!(qq{0} eq qq{\x25U}))' exec-spec-interpolation.service: Main process exited, code=exited, status=1/FAILURE exec-spec-interpolation.service: Unit entered failed state. exec-spec-interpolation.service: Failed with result 'exit-code'. PID: 11270 Start Timestamp: Wed 2016-02-17 22:21:31 UTC Exit Timestamp: Wed 2016-02-17 22:21:31 UTC Exit Code: exited Exit Status: 1 Assertion 'service->main_exec_status.status == status_expected' failed at src/test/test-execute.c:65, function check(). Aborting. --- src/test/test-execute.c | 5 +++++ test/test-execute/exec-spec-interpolation.service | 6 ++++++ 2 files changed, 11 insertions(+) create mode 100644 test/test-execute/exec-spec-interpolation.service diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 92857cb5e2..d021be4671 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -263,6 +263,10 @@ static void test_exec_ioschedulingclass(Manager *m) { test(m, "exec-ioschedulingclass-best-effort.service", 0, CLD_EXITED); } +static void test_exec_spec_interpolation(Manager *m) { + test(m, "exec-spec-interpolation.service", 0, CLD_EXITED); +} + int main(int argc, char *argv[]) { test_function_t tests[] = { test_exec_workingdirectory, @@ -284,6 +288,7 @@ int main(int argc, char *argv[]) { test_exec_capabilityambientset, test_exec_oomscoreadjust, test_exec_ioschedulingclass, + test_exec_spec_interpolation, NULL, }; test_function_t *test = NULL; diff --git a/test/test-execute/exec-spec-interpolation.service b/test/test-execute/exec-spec-interpolation.service new file mode 100644 index 0000000000..3e62662aa9 --- /dev/null +++ b/test/test-execute/exec-spec-interpolation.service @@ -0,0 +1,6 @@ +[Unit] +Description=https://github.com/systemd/systemd/issues/2637 + +[Service] +Type=oneshot +ExecStart=/bin/sh -x -c "perl -e 'exit(!(qq{%%U} eq qq{\\x25U}))'" -- cgit v1.2.3-54-g00ecf From bd1b973fb326e9b7587494fd6108e5ded46e9163 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Wed, 17 Feb 2016 22:32:36 +0000 Subject: core: revert "core: resolve specifier in config_parse_exec()" This reverts commit cb48dfca6a8bc15d9081651001a16bf51e03838a. Exec*-settings resolve specifiers twice: %%U -> config_parse_exec [cb48dfca6a8] -> %U -> service_spawn -> 0 Fixes #2637 --- src/core/load-fragment.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/core/load-fragment.c b/src/core/load-fragment.c index b31bf83f47..4a65d174b8 100644 --- a/src/core/load-fragment.c +++ b/src/core/load-fragment.c @@ -574,9 +574,7 @@ int config_parse_exec( void *data, void *userdata) { - _cleanup_free_ char *cmd = NULL; ExecCommand **e = data; - Unit *u = userdata; const char *p; bool semicolon; int r; @@ -585,7 +583,6 @@ int config_parse_exec( assert(lvalue); assert(rvalue); assert(e); - assert(u); e += ltype; rvalue += strspn(rvalue, WHITESPACE); @@ -596,13 +593,7 @@ int config_parse_exec( return 0; } - r = unit_full_printf(u, rvalue, &cmd); - if (r < 0) { - log_syntax(unit, LOG_ERR, filename, line, r, "Failed to resolve unit specifiers on %s, ignoring: %m", rvalue); - return 0; - } - - p = cmd; + p = rvalue; do { _cleanup_free_ char *path = NULL, *firstword = NULL; bool separate_argv0 = false, ignore = false; -- cgit v1.2.3-54-g00ecf