From ec89205cbba947e32ea538fb4388d7827b774c1b Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Sat, 3 Oct 2026 09:21:06 +0200 Subject: [PATCH] ExecContext: Map ENOTDIR to FileNotFoundError _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 --- src/python/jw/pkg/lib/ExecContext.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/python/jw/pkg/lib/ExecContext.py b/src/python/jw/pkg/lib/ExecContext.py index 1e5d6f30..9c137cc9 100644 --- a/src/python/jw/pkg/lib/ExecContext.py +++ b/src/python/jw/pkg/lib/ExecContext.py @@ -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)