run: let systemd resolve the path with RootDirectory=/RootImage=
Fixes #13338.
This commit is contained in:
parent
526e3cbbdd
commit
8038b99d0d
|
@ -1354,8 +1354,10 @@ int bus_set_transient_exec_command(
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (!path_is_absolute(path))
|
if (!path_is_absolute(path) && !filename_is_valid(path))
|
||||||
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Path %s is not absolute.", path);
|
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS,
|
||||||
|
"\"%s\" is neither a valid executable name nor an absolute path",
|
||||||
|
path);
|
||||||
|
|
||||||
r = sd_bus_message_read_strv(message, &argv);
|
r = sd_bus_message_read_strv(message, &argv);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
|
|
|
@ -1720,11 +1720,15 @@ static int run(int argc, char* argv[]) {
|
||||||
if (r <= 0)
|
if (r <= 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
if (!strv_isempty(arg_cmdline) && arg_transport == BUS_TRANSPORT_LOCAL) {
|
if (!strv_isempty(arg_cmdline) &&
|
||||||
|
arg_transport == BUS_TRANSPORT_LOCAL &&
|
||||||
|
!strv_find_startswith(arg_property, "RootDirectory=") &&
|
||||||
|
!strv_find_startswith(arg_property, "RootImage=")) {
|
||||||
|
/* Patch in an absolute path to fail early for user convenience, but only when we can do it
|
||||||
|
* (i.e. we will be running from the same file system). This also uses the user's $PATH,
|
||||||
|
* while we use a fixed search path in the manager. */
|
||||||
|
|
||||||
_cleanup_free_ char *command = NULL;
|
_cleanup_free_ char *command = NULL;
|
||||||
|
|
||||||
/* Patch in an absolute path */
|
|
||||||
|
|
||||||
r = find_executable(arg_cmdline[0], &command);
|
r = find_executable(arg_cmdline[0], &command);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return log_error_errno(r, "Failed to find executable %s: %m", arg_cmdline[0]);
|
return log_error_errno(r, "Failed to find executable %s: %m", arg_cmdline[0]);
|
||||||
|
|
Loading…
Reference in a new issue