From c0da06c05dbc585c8669e141f3d023fee2295f7d Mon Sep 17 00:00:00 2001 From: KhooLy <73142442+KhooLy@users.noreply.github.com> Date: Mon, 20 Jul 2026 16:18:20 +0300 Subject: [PATCH] Fix follow-up bug from the bindgen_env unbound-variable patch The \${arr[@]:-} default-value form avoids bash 3.2's unbound-variable error on an empty array, but on macOS's stock bash it still expands to a single empty-string word, so `env "" cargo build ...` tried to exec an empty command name and failed with exit 127. Build the cargo invocation as an array and only wrap it with `env` when bindgen_env actually has entries, avoiding any [@] expansion of an empty array. --- appleApp/scripts/build-rust-core-xcframework.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/appleApp/scripts/build-rust-core-xcframework.sh b/appleApp/scripts/build-rust-core-xcframework.sh index 4e641c5..98b85f8 100755 --- a/appleApp/scripts/build-rust-core-xcframework.sh +++ b/appleApp/scripts/build-rust-core-xcframework.sh @@ -59,10 +59,13 @@ build_rust_core() { fi fi - if [[ "$profile" == "Release" ]]; then - env "${bindgen_env[@]:-}" cargo build --no-default-features --features ios "$@" --release + local cargo_cmd=(cargo build --no-default-features --features ios "$@") + [[ "$profile" == "Release" ]] && cargo_cmd+=(--release) + + if [[ ${#bindgen_env[@]} -gt 0 ]]; then + env "${bindgen_env[@]}" "${cargo_cmd[@]}" else - env "${bindgen_env[@]:-}" cargo build --no-default-features --features ios "$@" + "${cargo_cmd[@]}" fi }