Artifact 88716d6069ea029ea2644a54989c4836f82c800c025f5f8758fbc5eaa35b6b93:
- File
test/fuzz_lintline.c
— part of check-in
[6516a0e4da]
at
2026-11-13 12:54:25
on branch trunk
— Phase 7a: a lint guards every check-in, and edits made in place are checked in
suit lint and suit commit refuse a change that holds a token-shaped value, tool-attribution text, a symlink, or a skill folder with no header. A suit.lint file in the wardrobe can exempt a path or forbid an extra phrase. The lint never changes a file.
suit tend is the hourly entry point. For now it checks in edits made in the store, after the lint. A change that deletes more than five files and more than a fifth of the wardrobe is held until it is confirmed. Anything that needs a person is written to an attention file, which suit status shows under 'needs you'.
A symlink refusal now comes from the lint and exits 3, where it exited 16 before.
Also fixed, found by the forge's runner: a file suit rewrote came back with default permissions, keeping only its executable bit. On the runner a project's local exclude file went from rw-rw---- to rw-r----- across apply and off. A rewritten file now keeps exactly the permissions it had. Tests rewrite files of four different modes under two different defaults, so the development machine catches it too. Three tests that restored a folder to a fixed mode now put back only the bits they took away.
1204 unit checks, 227 shell cases, 323 store cases, 612 placement cases and 378 project cases, under clang, under gcc 16, with no user name set, and under a strict umask. 100% coverage in all 21 source files. No suite has fewer cases than at the last check-in. (user: dmestas, size: 1244) [annotate] [blame] [check-ins using]
// Fuzz target for the line scanner: a refused line stays refused when text is // added at its end, and a file of one line gives one problem exactly when the // line is refused. #include "lint.h" #include "platform.h" #include <stdint.h> #include <string.h> static const LintRules none; static char longer[LINT_LINE_MAX + 2]; int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); static void count(void *state, size_t line, const char *what) { (void)line; (void)what; ++*(size_t *)state; } int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (size > LINT_LINE_MAX) return 0; const char *what = lint_line(&none, (const char *)data, size); if (what != nullptr) { memcpy(longer, data, size); longer[size] = 'x'; ensure(lint_line(&none, longer, size + 1) != nullptr); } bool one_line = memchr(data, '\n', size) == nullptr && memchr(data, '\0', size < LINT_BINARY_PROBE ? size : LINT_BINARY_PROBE) == nullptr; if (one_line && size > 0) { size_t problems = 0; [[maybe_unused]] size_t n = lint_text(&none, false, (const char *)data, size, count, &problems); ensure(n == problems && n == (what != nullptr ? 1u : 0u)); } return 0; }