]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
kernel-install: unquote plugin paths in KERNEL_INSTALL_PLUGINS
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 17 Sep 2024 19:59:38 +0000 (04:59 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 18 Sep 2024 00:47:00 +0000 (09:47 +0900)
To support the case that paths to plugins contain spaces.

Prompted by #34459

src/kernel-install/kernel-install.c
src/kernel-install/test-kernel-install.sh

index 408de8a0e5c46649a857c6e3848dd24e875995a0..a937d03166cf2e38089cb39e969d5d85293ba114 100644 (file)
@@ -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);
 }
index 0e419798782e827d30953393454d2109f7691923..51d618e6501e888dee9a269a231e47e5f84e4dee 100755 (executable)
@@ -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'