From 8a4e2f364a90cd546433eadfa7a268ab2fd5ba41 Mon Sep 17 00:00:00 2001 From: hoywu Date: Wed, 24 Jun 2026 11:42:16 +0800 Subject: [PATCH] fix(setup): invoke Linux setup_backend via explicit bash to avoid execute-bit / interpreter issues Previously invoke_setup splatted the script path with its arguments directly (""${args[@]}""), which relies on the script having a valid shebang and the executable bit set when invoked from a different process state or via some shell wrappers. The Windows Invoke-Bootstrap counterpart launches its bootstrap via a stable interpreter entry (powershell -File), and the Linux path should be at least as robust. - Resolve the setup script to an absolute path under $SCRIPT_DIR and run it explicitly with 'bash "$setup_script" "${setup_args[@]}"', so the shebang/exec bit is not on the critical path. - Rename the local array to setup_args / setup_script to make intent clearer at the call sites. This keeps the recreate-on-existing-python behaviour from the previous fix and matches the Windows pipeline's "stable interpreter invocation" convention. --- one-click-start.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/one-click-start.sh b/one-click-start.sh index 167397c..8b9fce1 100755 --- a/one-click-start.sh +++ b/one-click-start.sh @@ -161,21 +161,22 @@ invoke_setup() { local setup_target="$1" local venv_py="$2" local force_recreate="${3:-0}" - local args=("scripts/setup_backend_linux.sh" "--target" "$setup_target") + local setup_script="$SCRIPT_DIR/scripts/setup_backend_linux.sh" + local -a setup_args=("--target" "$setup_target") # 与 Windows Invoke-Bootstrap 一致:外来/损坏 venv,或目标 python 已存在时先删再建。 if [ "$force_recreate" -eq 1 ] || { [ -n "$venv_py" ] && [ -e "$venv_py" ]; }; then echo "Existing backend environment failed portability/import checks. Recreating it..." - args+=("--recreate") + setup_args+=("--recreate") fi for arg in "${PIP_ARGS[@]}"; do - args+=("--pip-arg" "$arg") + setup_args+=("--pip-arg" "$arg") done mkdir -p "$SCRIPT_DIR/logs" echo "详细安装日志: $SCRIPT_DIR/logs/backend-install.log" - "${args[@]}" 2>&1 | tee "$SCRIPT_DIR/logs/backend-install.log" + bash "$setup_script" "${setup_args[@]}" 2>&1 | tee "$SCRIPT_DIR/logs/backend-install.log" } assert_required_files