Repository navigation
rust2(find): GNU findutils 4.9 find library port + 317-row gate (#1488) - #1634
caomengxuan666 wants to merge 4 commits into
Conversation
… awk family) (#1488) Adds winux_regex::dialect: the 13 findutils -regextype syntax families (lib/regextype.c order) rewritten onto the native grep BRE/ERE pair. emacs (the GNU find default) keeps \( \| groups, bare + ? operators, literal ( ) | { }, no intervals, no char classes; posix-basic/ed/sed reject dup-after-dup; posix-extended/posix-awk reject a leading operator; the awk family escapes inside brackets. Every rule pinned against find 4.9.0 probes; glibc_message() renders REG_* wording. Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Library-form find over the Windows value model:
* parse: leading -H -L -P -D -O, start points, GNU's flat predicate
list (implicit -a, global options as no-op primaries, artificial
"( ... ) -print" wrapping) folded by the tree.c get_expr/scan_rest
algorithm, so every GNU diagnostic fires at the same token;
* every test/action of 4.9: -name/-path/-lname (+i) fnmatch, -regex
through winux_regex::dialect (emacs default, all 13 -regextype),
-type/-xtype lists, -size rounding, -empty, -mtime/-mmin/-used/
-daystart/-newer/-newerXY (dates via touch's parse_datetime), -perm
(modemap), -user/-group/-uid/-gid/-nouser/-nogroup, -readable/
-writable/-executable, -links/-inum/-samefile/-fstype, -print/-print0/
-printf (print.c port, all directives and quirks)/-fprint*/-ls/-fls,
-prune/-quit/-delete, -exec/-execdir/-ok/-okdir with {} + batching;
* lazy iterative walk (one FindFirstFileExW handle per level, no tree
materialization; enumeration records answer the cheap predicates, a
handle open only for ctime/nlink/ino/dev/alloc), junctions and
symlinks are links, -L loop detection, -xdev, post-order for
-depth/-delete;
* children launch through childproc (resolve_child +
build_child_command, inherited stdio, stdout flushed first).
touch::parse_datetime becomes pub(crate) for -newermt; winux-cmds gains
the in-workspace winux-regex path dependency (no crates.io deps).
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
`.*TAIL` whole-matches a path iff TAIL whole-matches a suffix that starts on a codepoint boundary. The split is taken only when exact (no top-level alternation, no quantified .*, no left-context token in TAIL, no newline in the path) and turns one state-per-position interpreter run into a few first-byte-filtered suffix attempts: 200k-entry tree `-regex '.*/f0[0-4][0-9]\.rs'` 7.77 s -> 0.92 s (C++ 1.x find 5.70 s). rx tests pin split == full-match on a mixed corpus. Also pins two test expectations to the GNU probes (printf %o flag string; an unrunnable `;` command is a false test with rc 0). Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…#1488) Review-lane additions on top of the find library port: - find.tsv: 317 rows total (was 304); fd350-363 add the dangling-link family (-H/-L dangling starts, -L -type l, %Y='N', -delete on the link), -path start matching, -iname bracket-class case folding, -perm -000, -ok Y prompt, -exec {} + with no matches, multi-root -quit, multi-letter -type with links. Every row probe-attested against WSL findutils 4.9 before entry (scratch/find-review/). - fd362 (-fprint /dev/stdout) deliberately omitted: the gate host rewrites the literal in native-child argv (CONOUT$) — a harness transport boundary, not a find semantics bug; open_file's special case is correct. Pin via a unit test at wire time (comment left in gen-cases.py). - gen-cases.py: find_rows + find table registration + a sorted- comparison mode for the diagnostic rows (GNU reorders adjacent stdout/stderr lines). - run-gate.sh: +16 lines harness fix; lib.rs registers find. Gate: 317 rows = 183 strict + 119 sorted + 4 exit + 10 win + 1 note; GNU-gated 307 PASS / 0 FAIL, win-gated 10 PASS / 0 FAIL. cargo test -p winux-cmds find: 24/0.
Review verdict: FAIL (F1 — blocking)PR #1634 (head F1 —
|
|
Library landed on main via #1696 (find wire). |
The inventory still called six commands c++-only after their rust2 library/wire landed. Rows now say state=wired, status=rust2-wired, engine=rust2, with commit evidence in the anchor: - ls: unixwin#1762 library 3025942; f87be22 wire (this branch) - rm: unixwin#1751 library 38e6835; f14bc60 wire (this branch) - find: unixwin#1634 library; 792c31f (unixwin#1696 wire); unixwin#1633/unixwin#1658 help/version - grep: unixwin#1660 library; 0eb0d28 (unixwin#1660 wire); -P face stayed on the C++ PCRE2 path per DOCS/2.0-regex-engine-decision.md - mv: unixwin#1649; a0cfcd7 (unixwin#1773 reland that wired the 1.x retirement) - sed: unixwin#1635 library; f36f306 (unixwin#1690 wire) No code changes; loc/oracle/test columns are historical measurements and stay as recorded.
Library landing for the find big-ticket lane (5072 lines, 9 modules) + review-wave gate additions. C++ body retirement / dispatch wiring follows at wire time.
Scope (semantic checklist all-green vs findutils 4.9):
Evidence: gate 317 rows = 307 GNU-gated PASS / 0 FAIL + 10 win PASS / 0 FAIL (13 review rows probe-attested before entry); cargo test find 24/0. fd362 (-fprint /dev/stdout) documented as harness-transport-only, to be pinned by a unit test at wire time.
Known deviations (declared): warnings default OFF (injected-IO contract; -warn enables), -D debug flags accepted without GNU's diagnostic streams, -execdir insecure-PATH check skipped, -exec {} + Windows command-line cap, %B/-newerB* uses creation time, -type b accepted but never produced.
Expected CI status: i18n-drift will report keys until the wire commit lands tr! keys (checkpoint I18N prerequisite — find's message face is currently hardcoded English). Compile/test legs should be green.
Cross-lane note: #1617 precedence deviation of the C++ pre-scan tracked in #1633; rust2's sequential predicate-table parse is the authoritative semantics.