From c35b0ecf4fc20db5f430ab706482394ce6a9e5fb Mon Sep 17 00:00:00 2001 From: DKChan <524912269@qq.com> Date: Tue, 3 Nov 2026 04:25:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E7=A8=8B(ci=E8=BF=9C=E7=AB=AF?= =?UTF-8?q?=E5=8C=96=C2=B7=E4=BF=AE=E5=A4=8D):=20=E7=AC=AC=E4=B8=89?= =?UTF-8?q?=E8=BD=AE=E4=B8=A4=E6=A0=B9=E5=9B=A0=E2=80=94=E2=80=94SRC=5FZIP?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=BC=8Fv=E5=89=8D=E7=BC=80=E8=87=B4?= =?UTF-8?q?=E5=A4=8D=E7=94=A8=E6=8E=A2=E6=B5=8B=E8=90=BD=E7=A9=BA(?= =?UTF-8?q?=E4=B8=8B=E8=BD=BDURL=E4=BF=AE=E4=BA=86=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E6=B2=A1=E8=B7=9F)+macOS=20BSD=20mktemp=E7=A6=81X=E5=90=8E?= =?UTF-8?q?=E5=B8=A6=E5=90=8E=E7=BC=80(GNU=E5=85=81=E8=AE=B8=E5=8F=AF?= =?UTF-8?q?=E7=BC=80=E5=B0=BE,=E9=A6=96=E8=BD=AE404=E7=9A=84=E5=AD=97?= =?UTF-8?q?=E9=9D=A2=E6=AE=8B=E7=95=99=E6=96=87=E4=BB=B6=E8=87=B4File=20ex?= =?UTF-8?q?ists);=20=E4=B8=89=E5=A4=84mktemp=E6=A8=A1=E6=9D=BF=E6=94=B9?= =?UTF-8?q?=E5=B0=BEX=E5=BD=A2=E6=80=81+=E8=84=9A=E6=9C=AC=E5=A4=B4?= =?UTF-8?q?=E9=83=A8=E5=8A=A0=E5=AD=97=E9=9D=A2=E6=AE=8B=E7=95=99=E6=B8=85?= =?UTF-8?q?=E7=90=86+gate=5Fplatform=E5=90=8C=E5=9E=8B=E5=9C=B0=E9=9B=B7?= =?UTF-8?q?=E5=90=8C=E4=BF=AE;=20=E5=85=A8=E9=83=A8=E5=88=86=E6=94=AF?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=E5=B7=B2=E5=9C=A8Mac=E6=9C=AC=E6=9C=BA?= =?UTF-8?q?=E5=AE=9E=E6=B5=8B(=E5=A4=8D=E7=94=A8=E5=91=BD=E4=B8=AD/mktemp?= =?UTF-8?q?=E5=BD=A2=E6=80=81/=E5=8C=85=E5=AE=8C=E6=95=B4=E6=80=A7/?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E7=9B=AE=E5=BD=95)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tools/ci/mac_setup.sh | 7 ++++--- tools/gate_platform.sh | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tools/ci/mac_setup.sh b/tools/ci/mac_setup.sh index 802361bf..6577a9ae 100644 --- a/tools/ci/mac_setup.sh +++ b/tools/ci/mac_setup.sh @@ -42,6 +42,7 @@ while [ $# -gt 0 ]; do *) die "未知参数: $1" ;; esac done +rm -f /tmp/godot_mac_XXXXXX.zip /tmp/gdstyle_XXXXXX.tar.gz 2>/dev/null || true # 早期 BSD-mktemp 缺陷的字面残留清理 # ── 1. 专用账户+密码落盘(自动登录需要密码编码进 /etc/kcpassword,root 600)── if dscl . -read "${CI_HOME}" NFSHomeDirectory >/dev/null 2>&1; then @@ -84,13 +85,13 @@ if /usr/local/bin/godot --version >/dev/null 2>&1 && /usr/local/bin/godot --vers log "Godot ${GODOT_VER} 已在位,跳过" else ZIP="" - SRC_ZIP="/Users/${INVOKER}/godot-linux/Godot_${GODOT_VER}-stable_macos.universal.zip" + SRC_ZIP="/Users/${INVOKER}/godot-linux/Godot_v${GODOT_VER}-stable_macos.universal.zip" if [ -n "$GODOT_ZIP" ] && [ -s "$GODOT_ZIP" ]; then ZIP="$GODOT_ZIP"; log "使用本地 zip: $ZIP" elif [ -s "$SRC_ZIP" ]; then ZIP="$SRC_ZIP"; log "复用已下载 zip: $ZIP" else - ZIP="$(mktemp "${TMPDIR:-/tmp}/godot_mac_XXXXXX.zip")" + ZIP="$(mktemp "${TMPDIR:-/tmp}/godot_mac_XXXXXX")" # macOS BSD mktemp 禁 X 后带后缀 _ok=0 for m in "${MIRRORS[@]}"; do log "下载 Godot(${m:+经 $m})" @@ -115,7 +116,7 @@ fi if /usr/local/bin/gdstyle --version >/dev/null 2>&1; then log "gdstyle 已在位,跳过" else - TGZ="$(mktemp "${TMPDIR:-/tmp}/gdstyle_XXXXXX.tar.gz")" + TGZ="$(mktemp "${TMPDIR:-/tmp}/gdstyle_XXXXXX")" # macOS BSD mktemp 禁 X 后带后缀 SRC_TGZ="/Users/${INVOKER}/godot-linux/gdstyle-x86_64-apple-darwin.tar.gz" if [ -s "$SRC_TGZ" ] && tar -tzf "$SRC_TGZ" >/dev/null 2>&1; then TGZ="$SRC_TGZ"; log "复用已下载 gdstyle 包: $TGZ" diff --git a/tools/gate_platform.sh b/tools/gate_platform.sh index 77385dd2..8847cae3 100644 --- a/tools/gate_platform.sh +++ b/tools/gate_platform.sh @@ -58,13 +58,14 @@ gate_run_timeout() { gate_orphans() { local gp="$1" if gate_is_win; then - local tmpf - tmpf="$(mktemp "${TMPDIR:-/tmp}/gateorph_XXXXXX.ps1")" + local tmpd tmpf + tmpd="$(mktemp -d "${TMPDIR:-/tmp}/gateorph_XXXXXX")" # macOS BSD mktemp 禁 X 后带后缀(本分支 Windows 专用,模板统一防复用) + tmpf="$tmpd/k.ps1" local gp_win gp_win="$(cygpath -m "$gp")" printf "Get-CimInstance Win32_Process -Filter \"Name like 'Godot%%'\" | Where-Object { \$_.CommandLine -like '*%s*' } | ForEach-Object { \$_.ProcessId }\n" "$gp_win" > "$tmpf" powershell -NoProfile -ExecutionPolicy Bypass -File "$(cygpath -w "$tmpf")" 2>/dev/null | tr -d '\r' - rm -f "$tmpf" + rm -rf "$tmpd" else ps -axo pid=,command= 2>/dev/null | awk -v g="$gp" 'tolower($0) ~ /godot/ && index($0, g) {print $1}' fi