diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-03-25 20:50:15 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-04-16 16:09:46 +0200 |
commit | 5008da1ec1cf2cf8c15b702c4052e3a49583095d (patch) | |
tree | 68b4ae04a7f7a751ae6c3e4f1e85a83906bb2db5 /src/test/test-execute.c | |
parent | f79cd1a9b2111a228bbb5b6de6fb836ad515c5c8 (diff) | |
download | systemd-5008da1ec1cf2cf8c15b702c4052e3a49583095d.tar.gz |
systemd: do not require absolute paths in ExecStart
Absolute paths make everything simple and quick, but sometimes this requirement
can be annoying. A good example is calling 'test', which will be located in
/usr/bin/ or /bin depending on the distro. The need the provide the full path
makes it harder a portable unit file in such cases.
This patch uses a fixed search path (DEFAULT_PATH which was already used as the
default value of $PATH), and if a non-absolute file name is found, it is
immediately resolved to a full path using this search path when the unit is
loaded. After that, everything behaves as if an absolute path was specified. In
particular, the executable must exist when the unit is loaded.
Diffstat (limited to 'src/test/test-execute.c')
-rw-r--r-- | src/test/test-execute.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/test-execute.c b/src/test/test-execute.c index 81f9b7c344..4c15f1acd5 100644 --- a/src/test/test-execute.c +++ b/src/test/test-execute.c @@ -549,6 +549,10 @@ static void test_exec_capabilityboundingset(Manager *m) { test(m, "exec-capabilityboundingset-invert.service", 0, CLD_EXITED); } +static void test_exec_basic(Manager *m) { + test(m, "exec-basic.service", 0, CLD_EXITED); +} + static void test_exec_ambientcapabilities(Manager *m) { int r; @@ -648,6 +652,7 @@ static int run_tests(UnitFileScope scope, const test_function_t *tests) { int main(int argc, char *argv[]) { _cleanup_(rm_rf_physical_and_freep) char *runtime_dir = NULL; static const test_function_t user_tests[] = { + test_exec_basic, test_exec_ambientcapabilities, test_exec_bindpaths, test_exec_capabilityboundingset, |