mirror of
https://github.com/systemd/systemd.git
synced 2024-11-04 13:51:24 +03:00
Merge pull request #2646 from evverx/fix-2637
Fix #2637 (doubled specifier expansion in ExecStart=)
This commit is contained in:
commit
57156d9507
@ -574,9 +574,7 @@ int config_parse_exec(
|
|||||||
void *data,
|
void *data,
|
||||||
void *userdata) {
|
void *userdata) {
|
||||||
|
|
||||||
_cleanup_free_ char *cmd = NULL;
|
|
||||||
ExecCommand **e = data;
|
ExecCommand **e = data;
|
||||||
Unit *u = userdata;
|
|
||||||
const char *p;
|
const char *p;
|
||||||
bool semicolon;
|
bool semicolon;
|
||||||
int r;
|
int r;
|
||||||
@ -585,7 +583,6 @@ int config_parse_exec(
|
|||||||
assert(lvalue);
|
assert(lvalue);
|
||||||
assert(rvalue);
|
assert(rvalue);
|
||||||
assert(e);
|
assert(e);
|
||||||
assert(u);
|
|
||||||
|
|
||||||
e += ltype;
|
e += ltype;
|
||||||
rvalue += strspn(rvalue, WHITESPACE);
|
rvalue += strspn(rvalue, WHITESPACE);
|
||||||
@ -596,13 +593,7 @@ int config_parse_exec(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
r = unit_full_printf(u, rvalue, &cmd);
|
p = rvalue;
|
||||||
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;
|
|
||||||
do {
|
do {
|
||||||
_cleanup_free_ char *path = NULL, *firstword = NULL;
|
_cleanup_free_ char *path = NULL, *firstword = NULL;
|
||||||
bool separate_argv0 = false, ignore = false;
|
bool separate_argv0 = false, ignore = false;
|
||||||
|
@ -263,6 +263,10 @@ static void test_exec_ioschedulingclass(Manager *m) {
|
|||||||
test(m, "exec-ioschedulingclass-best-effort.service", 0, CLD_EXITED);
|
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[]) {
|
int main(int argc, char *argv[]) {
|
||||||
test_function_t tests[] = {
|
test_function_t tests[] = {
|
||||||
test_exec_workingdirectory,
|
test_exec_workingdirectory,
|
||||||
@ -284,6 +288,7 @@ int main(int argc, char *argv[]) {
|
|||||||
test_exec_capabilityambientset,
|
test_exec_capabilityambientset,
|
||||||
test_exec_oomscoreadjust,
|
test_exec_oomscoreadjust,
|
||||||
test_exec_ioschedulingclass,
|
test_exec_ioschedulingclass,
|
||||||
|
test_exec_spec_interpolation,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
test_function_t *test = NULL;
|
test_function_t *test = NULL;
|
||||||
|
6
test/test-execute/exec-spec-interpolation.service
Normal file
6
test/test-execute/exec-spec-interpolation.service
Normal file
@ -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}))'"
|
Loading…
Reference in New Issue
Block a user