-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Description
Context
In PR #9466, a review comment identified that the qemu_invocation array in run_host_x86_binary_logged should use the ${array[*]Q} quoting pattern when passed to run_host_command_logged.
Reference: #9466 (comment)
What Needs to Change
In lib/functions/logging/runners.sh around lines 207-218, the current code:
run_host_command_logged env -u QEMU_CPU "${qemu_invocation[@]}"Should be updated to:
local -a invocation=("env" "-u" "QEMU_CPU" "${qemu_invocation[@]}")
run_host_command_logged "${invocation[*]Q}"Why This Change is Needed
The run_host_command_logged function executes commands via bash -c "$*". When an array is expanded using "${array[@]}" and then joined by $*, any element containing spaces or shell metacharacters will be re-parsed by bash, causing:
- Incorrect word splitting
- Unintended interpretation of special characters (semicolons, pipes, etc.)
The Q parameter expansion operator shell-quotes each array element, preserving spaces and special characters when the array is joined into a string and passed to bash.
Established Pattern
This follows an established pattern in the Armbian build system. As documented in previous PRs (e.g., #9159), when calling run_host_command_logged with arrays containing arguments that might have shell metacharacters, use "${array[*]Q}" instead of "${array[@]}".
Scope
This is a robustness improvement separate from the main purpose of PR #9466 (adding 32-bit x86 support). It should be implemented in a follow-up PR to keep changes focused.