From 1e5a65a6862c09d6ca80e23898ee85878b290fa4 Mon Sep 17 00:00:00 2001 From: Shaurya Singh Date: Sun, 24 May 2026 11:10:08 -0700 Subject: [PATCH] Fix script_phases.sh error() helper: missing echo + arg truncation (#56955) The error() helper had two bugs since its extraction from the Ruby script in commit 1dbbeb4: 1. The line that mirrors the formatted message to SCRIPT_OUTPUT_FILE_0 was missing the leading echo, so [Codegen] $1 was instead being executed as a command. Under set -e this aborts the script with status 127 before reaching exit 1, and SCRIPT_OUTPUT_FILE_0 receives a shell command not found error instead of the intended log line. 2. The function only printed $1, so multi-arg callers like find_node (which passes its message across three space-and-backslash continuation strings) were silently truncated to the first chunk. Switch both lines to use $* so all positional arguments are joined into a single space-separated message, and add the missing echo so the second line actually appends to the log file. Fixes #56955. --- .../scripts/react_native_pods_utils/script_phases.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/react-native/scripts/react_native_pods_utils/script_phases.sh b/packages/react-native/scripts/react_native_pods_utils/script_phases.sh index 4606f35fbe69..46d801326de9 100755 --- a/packages/react-native/scripts/react_native_pods_utils/script_phases.sh +++ b/packages/react-native/scripts/react_native_pods_utils/script_phases.sh @@ -16,8 +16,13 @@ cd "$RCT_SCRIPT_RN_DIR" CODEGEN_CLI_PATH="" error () { - echo "$1" - "[Codegen] $1" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1 + # Print the full message (all positional args, space-separated) so multi-arg + # callers like find_node don't get truncated to just $1. Mirror the same + # message into SCRIPT_OUTPUT_FILE_0; the previous version was missing the + # leading `echo`, so the formatted string was instead being executed as a + # command and the shell error landed in the log file. + echo "$*" + echo "[Codegen] $*" >> "${SCRIPT_OUTPUT_FILE_0}" 2>&1 exit 1 }