Skip to content

Commit

Permalink
kernel-install: unquote plugin paths in KERNEL_INSTALL_PLUGINS
Browse files Browse the repository at this point in the history
To support the case that paths to plugins contain spaces.

Prompted by systemd#34459
  • Loading branch information
yuwata committed Sep 18, 2024
1 parent 0432e28 commit 6e1816e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/kernel-install/kernel-install.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,15 +404,16 @@ static int context_set_path_strv(Context *c, char* const* strv, const char *sour

static int context_set_plugins(Context *c, const char *s, const char *source) {
_cleanup_strv_free_ char **v = NULL;
int r;

assert(c);

if (c->plugins || !s)
return 0;

v = strv_split(s, NULL);
if (!v)
return log_oom();
r = strv_split_full(&v, s, NULL, EXTRACT_UNQUOTE);
if (r < 0)
return log_error_errno(r, "Failed to parse plugin paths from %s: %m", source);

return context_set_path_strv(c, v, source, "plugins", &c->plugins);
}
Expand Down
8 changes: 7 additions & 1 deletion src/kernel-install/test-kernel-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,13 @@ echo 'DTBDTBDTBDTB' >"$D/sources/subdir/whatever.dtb"

export KERNEL_INSTALL_CONF_ROOT="$D/sources"
# We "install" multiple plugins, but control which ones will be active via install.conf.
export KERNEL_INSTALL_PLUGINS="${ukify_install} ${loaderentry_install} ${uki_copy_install}"
KERNEL_INSTALL_PLUGINS="'${loaderentry_install}' '${uki_copy_install}'"
if [[ -n "$ukify_install" ]]; then
# shellcheck disable=SC2089
KERNEL_INSTALL_PLUGINS="'${ukify_install}' $KERNEL_INSTALL_PLUGINS"
fi
# shellcheck disable=SC2090
export KERNEL_INSTALL_PLUGINS
export BOOT_ROOT="$D/boot"
export BOOT_MNT="$D/boot"
export MACHINE_ID='3e0484f3634a418b8e6a39e8828b03e3'
Expand Down

0 comments on commit 6e1816e

Please sign in to comment.