TL;DR: Applying the Jaeyoon Jung patch (with fixups) to dunfell or thud
does not fix the core problem but breaks even more (thud and dunfell use '
), but the attached patches do.

I'm testing with extra config:
    KCONFIG_CONFIG_COMMAND_prepend=' X="1 2" '
    KCONFIG_CONFIG_COMMAND_prepend=" Y='a b' "
and then:
    bitbake virtual/kernel -c menuconfig

The result can then be examined by using ps to locate the make process, and
then
    tr '\0' '\n' < /proc/$PID/cmdline
and each line will show one of the "make" arguments, and it is easy to tell
whether multi-word arguments have been properly preserved and whether any
are missing.

I've also tested by adding a false target to KCONFIG_CONFIG_COMMAND
    KCONFIG_CONFIG_COMMAND_prepend=' zox X="1 2" '
    KCONFIG_CONFIG_COMMAND_prepend=" Y='a b' "
and ensured that it properly fails with:
    Command failed.
    Press any key to continue...

The biggest surprise was that without any patch, my
extra KCONFIG_CONFIG_COMMAND debug lines causes menuconfig to make the
kernel and skip menuconfig (because the command line was truncated), for
both thud and dunfell.

On thud and dunfell, a patch initially appears un-needed because (at least
in my setup) thud is using single quotes for KCONFIG_CONFIG_COMMAND:
    menuconfig HOSTLDFLAGS='-L.../...'
and so double quotes don't exist to terminate that string early. Of course,
that means they would both be broken by the original patch, or if double
quotes were used in a custom configuration.

I've attached a patch suitable for applying to thud, and another for
dunfell -- so that single or double quotes can be used.

Sam
From a8e847c3073fb380a2e35fcea1994a17ba68faf1 Mon Sep 17 00:00:00 2001
From: Sam Liddicott <[email protected]>
Date: Thu, 12 Sep 2024 17:18:37 +0100
Subject: [dunfell] avoid the need to escape KCONFIG_CONFIG_COMMAND for do_menuconfig

Although KCONFIG_CONFIG_COMMAND is shell-ready, it needs escaping
when composed as part of some shell which is then embedded into an 
outer "sh -c" in cml1.bbclass

This patch avoids the need to escape KCONFIG_CONFIG_COMMAND by inserting
it into the outer "sh -c" and passing it from there as optional args
with a dummy arg0

Signed-off-by: Sam Liddicott <[email protected]>
---
 meta/classes/cml1.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
index d319d66ab2..0dbaf25b8e 100644
--- a/meta/classes/cml1.bbclass
+++ b/meta/classes/cml1.bbclass
@@ -48,3 +48,3 @@ python do_menuconfig() {
 
-    oe_terminal("sh -c \"make %s; if [ \\$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
+    oe_terminal("sh -c 'make \"$@\" ; if [ $? -ne 0 ]; then echo \"Command failed.\"; printf \"Press any key to continue... \"; read r; fi' oe_terminal-cmd %s " % d.getVar('KCONFIG_CONFIG_COMMAND'),
                 d.getVar('PN') + ' Configuration', d)
-- 
2.43.0
From a8e847c3073fb380a2e35fcea1994a17ba68faf1 Mon Sep 17 00:00:00 2001
From: Sam Liddicott <[email protected]>
Date: Thu, 12 Sep 2024 17:18:37 +0100
Subject: avoid the need to escape KCONFIG_CONFIG_COMMAND for do_menuconfig

Although KCONFIG_CONFIG_COMMAND is shell-ready, it needs escaping
when composed as part of some shell which is then embedded into an 
outer "sh -c" in cml1.bbclass

This patch avoids the need to escape KCONFIG_CONFIG_COMMAND by inserting
it into the outer "sh -c" and passing it from there as optional args
with a dummy arg0

Signed-off-by: Sam Liddicott <[email protected]>
---
 meta/classes/cml1.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/classes/cml1.bbclass b/meta/classes/cml1.bbclass
index d319d66ab2..0dbaf25b8e 100644
--- a/meta/classes/cml1.bbclass
+++ b/meta/classes/cml1.bbclass
@@ -48,3 +48,3 @@ python do_menuconfig() {
 
-    oe_terminal("${SHELL} -c \"make %s; if [ \$? -ne 0 ]; then echo 'Command failed.'; printf 'Press any key to continue... '; read r; fi\"" % d.getVar('KCONFIG_CONFIG_COMMAND'),
+    oe_terminal("${SHELL} -c 'make \"$@\" ; if [ $? -ne 0 ]; then echo \"Command failed.\"; printf \"Press any key to continue... \"; read r; fi' oe_terminal-cmd %s " % d.getVar('KCONFIG_CONFIG_COMMAND'),
                 d.getVar('PN') + ' Configuration', d)
-- 
2.43.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#204488): 
https://lists.openembedded.org/g/openembedded-core/message/204488
Mute This Topic: https://lists.openembedded.org/mt/108416314/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to