fix(file-tools): count bad_size probe as an existing remote binary

_probe_regular_file returns "bad_size" only after `[ -f ]` succeeded and
`wc -c` output was unparseable, so a regular file IS present on the
execution target. Treat it as "exists" (the precise existing-binary
refusal) instead of the generic "unavailable" retry message; both refuse,
but the retry hint is wrong for a file that is known to exist. Mirrors
how the other _probe_regular_file callers treat bad_size.

Idea and the original report/Docker reproduction come from #122663, the
first submitted fix for this bug.

Fixes #122662

Co-authored-by: liuzikaii <2319582736@qq.com>
This commit is contained in:
kshitijk4poor
2026-09-26 18:23:22 +05:30
committed by kshitij
parent d17ff29f7d
commit b01d11d3f3

View File

@@ -468,7 +468,8 @@ def _target_regular_file_state(filepath: str, task_id: str = "default") -> str:
_size, status = file_ops._probe_regular_file(file_ops._expand_path(resolved or filepath))
except Exception:
return "unavailable"
if status == "ok":
if status in ("ok", "bad_size"):
# bad_size: ``[ -f ]`` succeeded, only ``wc`` was unparseable.
return "exists"
if status in ("missing", "not_regular"):
# not_regular: no REGULAR file at the path (dir/FIFO/dangling link) —