Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] ptest-cargo: fix quoted RUSTFLAGS passed to cargo
@ 2026-09-30  5:54 Deepesh.Varatharajan
  2026-10-02 12:59 ` [OE-core] " Ross Burton
  0 siblings, 1 reply; 3+ messages in thread
From: Deepesh.Varatharajan @ 2026-09-30  5:54 UTC (permalink / raw)
  To: openembedded-core; +Cc: Sundeep.Kokkonda, Deepesh.Varatharajan

From: AnnLeelu George <AnnLeelu.George@windriver.com>

do_compile_ptest_cargo passes RUSTFLAGS directly to the cargo environment,
bypassing the shell. As a result, BitBake's shell escaping is preserved and
can cause quoted cfg values to reach rustc incorrectly.

This can be reproduced with:

    DISTRO_FEATURES:append = " ptest"
    DEPRECATED_CRYPTO_FLAGS:pn-openssl = "no-des"

OpenSSL then defines OPENSSL_NO_DES, which openssl-sys emits as an osslconf
cfg. The resulting RUSTFLAGS contains:

    --cfg osslconf=\"OPENSSL_NO_DES\"

The rpm-sequoia ptest build consequently fails with:

    error: unknown start of token
    error[E0765]: unterminated double quote string

The normal cargo.bbclass path is unaffected because RUSTFLAGS is exported
through the shell, which removes the shell escaping before cargo sees it.

Parse RUSTFLAGS with shlex.split() before passing it to cargo so that the
value is normalized in the same way as the shell-based cargo path.

Signed-off-by: Deepesh Varatharajan <Deepesh.Varatharajan@windriver.com>
---
 meta/classes-recipe/ptest-cargo.bbclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/meta/classes-recipe/ptest-cargo.bbclass b/meta/classes-recipe/ptest-cargo.bbclass
index 62444e9cc6..bd1fc4583c 100644
--- a/meta/classes-recipe/ptest-cargo.bbclass
+++ b/meta/classes-recipe/ptest-cargo.bbclass
@@ -11,6 +11,7 @@ CARGO_TEST_BINARIES_FILES ?= "${B}/test_binaries_list"
 python do_compile_ptest_cargo() {
     import subprocess
     import json
+    import shlex
 
     cargo = bb.utils.which(d.getVar("PATH"), d.getVar("CARGO"))
     cargo_build_flags = d.getVar("CARGO_BUILD_FLAGS")
@@ -21,7 +22,7 @@ python do_compile_ptest_cargo() {
     manifest_dir = os.path.dirname(manifest_path)
 
     env = os.environ.copy()
-    env['RUSTFLAGS'] = rust_flags
+    env['RUSTFLAGS'] = ' '.join(shlex.split(rust_flags))
     cmd = f"{cargo} build --tests --message-format json {cargo_build_flags} {packageconfig_confargs}"
     bb.note(f"Building tests with cargo ({cmd})")
 
-- 
2.49.0



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-12 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-30  5:54 [PATCH] ptest-cargo: fix quoted RUSTFLAGS passed to cargo Deepesh.Varatharajan
2026-10-02 12:59 ` [OE-core] " Ross Burton
2026-10-12 11:21   ` Deepesh Varatharajan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox