From c0d8abd0a312059c75464659598336b99492dd05 Mon Sep 17 00:00:00 2001 From: vobloeb <76634406+vobloeb@users.noreply.github.com> Date: Fri, 22 May 2026 17:01:38 +0000 Subject: [PATCH] test/bintest.rb: tokenize ENV['EMULATOR'] via Shellwords.split MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `Command::CrossTestRunner#emulator` returns a shell-quoted string, which `Build#run_test` un-quotes via `sh`, but `CrossBuild#run_bintest` propagates verbatim through `ENV['EMULATOR']` to `test/bintest.rb`. The latter splices it into an Open3 exec-mode argv, where the literal `"` survives into `execve(2)` and the kernel returns `ENOENT`. Switching to `Shellwords.split(ENV['EMULATOR'])` round-trips the quoted string correctly and also fixes multi-token emulator commands (e.g. `qemu-aarch64 -L /sysroot`), which currently end up concatenated into `argv[0]`. Verified against mruby `3.3.0`, `3.4.0`, `4.0.0`, and `master`. Cross-build of mruby for `aarch64-unknown-linux-musl` (qemu-user 8.2.10): bintests went from 17/75 crashing → 100/100 passing. --- test/bintest.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/bintest.rb b/test/bintest.rb index 94bdf10ca..e5ec309ff 100644 --- a/test/bintest.rb +++ b/test/bintest.rb @@ -1,4 +1,5 @@ $:.unshift File.dirname(File.dirname(File.expand_path(__FILE__))) +require 'shellwords' require 'test/assert.rb' GEMNAME = "" @@ -16,7 +17,7 @@ def cmd_list(s) path_list = [cmd_bin(s)] emu = ENV['EMULATOR'] - path_list.unshift emu if emu && !emu.empty? + path_list.unshift(*Shellwords.split(emu)) if emu && !emu.empty? path_list end