ww: driver/coordinator robustness — dirent errors, EINTR, block comments

Three same-cluster robustness holes. enumeratedir treated a failed
getdents64 (r<0) as EOF: a mid-walk error silently truncated the
package source list, and a first-read error was misdiagnosed as
"directory contains no WW package sources" -- it now routes the
caller's "cannot read directory" arm. run_test_bin's waitpid had no
EINTR retry and its return was unchecked, so an interrupted wait
left status==0 and reported a false test PASS (the do_run twin
already retried). The coordinator's pkgskipspace now also skips
/* */ before the package clause like the driver's sep_skip_space --
a source opening with a block comment built under ww but failed
coordinator discovery.
This commit is contained in:
2026-08-09 02:05:48 +09:00
parent 999b110001
commit cd11d6e573
3 changed files with 30 additions and 1 deletions

View File

@@ -164,6 +164,22 @@ fn pkgskipspace(src: str, start: i32) i32 = {
for (i < src.len && src[i] != '\n') { i += 1; };
continue;
};
// The driver's sep_skip_space (cmd/ww/main.c) also skips
// /* */ before the package clause; without this arm a source
// opening with a block comment built under ww but failed
// coordinator discovery ("invalid or missing package
// clause"). An unterminated comment runs to EOF and the
// clause parse fails loud.
if (c == '/' && i + 1 < src.len && src[i + 1] == '*') {
i += 2;
for (i + 1 < src.len
&& !(src[i] == '*' && src[i + 1] == '/')) {
i += 1;
};
if (i + 1 >= src.len) { return src.len; };
i += 2;
continue;
};
break;
};
return i;