ExecContext: Map ENOTDIR to FileNotFoundError
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m15s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m53s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m23s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m40s
CI / Packaging test (push) Successful in 0s

_raise_stat_error() maps the message of a failed remote stat to an
exception. A stat below a file answers "not a directory", which falls
through to the generic EIO: the path is simply absent, and callers see a
re-raised error instead of the FileNotFoundError the "no such file" branch
already gives. Map it to FileNotFoundError, so existence checks see
absence.

Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.99.2
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-10-03 09:21:06 +02:00
commit ec89205cbb
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -37,6 +37,8 @@ def _raise_stat_error(path: str, result: Result) -> None:
lower = msg.lower()
if 'no such file' in lower:
raise FileNotFoundError(errno.ENOENT, msg, path)
if 'not a directory' in lower:
raise FileNotFoundError(errno.ENOTDIR, msg, path)
if 'permission denied' in lower or 'operation not permitted' in lower:
raise PermissionError(errno.EACCES, msg, path)
raise OSError(errno.EIO, msg, path)