Normalize the rebuild args comparison to stop spurious drop warnings

Why: adjust_args_for_bin strips the leading space of its return while the
rebuilt args keep it, so every rebuild carrying --dsn/--auth compared
unequal and warned that the legacy binary had the flags dropped even when
nothing was dropped — misleading during incident triage.

Evidence: bash -n clean; against the real dev binary the normalized
comparison reports no drop and the flags survive intact; make test green.

Impact: warning now fires only when flags are actually filtered; no
behavioral change to start/deploy.

Refs: PR #188
This commit is contained in:
2026-10-05 02:23:32 +00:00
parent 42e32f1596
commit 421ee87d04
+3 -1
View File
@@ -1248,7 +1248,9 @@ agent_do_start() {
fi
fi
local adjusted; adjusted="$(adjust_args_for_bin "$ENV_BIN" "$args")"
if [ "$adjusted" != "$args" ]; then
# adjust_args_for_bin 返回值已去首空格——比较前对 args 同样归一,否则每次
# 带 --dsn/--auth 的重建都会误报"旧版本二进制已自动省略"(参数实际全保留)。
if [ "$adjusted" != "${args# }" ]; then
c_warn "[$ENV_NAME] 该产物不支持 --dsn/--auth(旧版本二进制),已自动省略:$(mask_dsn "${args:-<无>}") → $(mask_dsn "${adjusted:-<无>}")"
fi
args="$adjusted"