Skip to content

feat(find): wire rust2 find into the product path (#1488) - #1696

Merged
caomengxuan666 merged 7 commits into
mainfrom
rust2/find-wire
Nov 14, 2026
Merged

caomengxuan666 merged 7 commits into
mainfrom
rust2/find-wire

Conversation

@caomengxuan666

Copy link
Copy Markdown
Member

C++ find body retired (5216 -> 402 lines: REGISTER_COMMAND + option table). Streaming stdin for -ok/-okdir and -files0-from -. 77 new tr! keys. Gate 317/317 (307 GNU + 10 win), ctest find.* 158/158 identical. -fprint /dev/stdout unit pin; #1633 pre-scan deviation gone. Refs #1488 #1633

caomengxuan666 and others added 7 commits November 14, 2026 12:42
… 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.
- C++ body retired (5216 -> 402 lines: REGISTER_COMMAND + option table)
- streaming stdin for -ok/-okdir and -files0-from -
- 77 new tr! keys, 33 orphan legacy keys listed
- gate 317/317 (307 GNU + 10 win), ctest find.* 158/158 identical
- -fprint /dev/stdout unit pin; #1633 pre-scan deviation gone
# Conflicts:
#	CMakeLists.txt
#	catalog/README.md
#	catalog/delta.json
#	catalog/en-US.json
#	rust2/GATE-REPORT.md
#	rust2/crates/winux-cmds/src/lib.rs
#	rust2/crates/winux-regex/src/lib.rs
#	rust2/gate/gen-cases.py
#	rust2/gate/run-gate.sh
@caomengxuan666
caomengxuan666 marked this pull request as ready for review November 14, 2026 11:16
@caomengxuan666
caomengxuan666 merged commit 792c31f into main Nov 14, 2026
@caomengxuan666
caomengxuan666 deleted the rust2/find-wire branch November 14, 2026 11:16
aphrody-dev pushed a commit to aphrody-labs/WinuxCmd that referenced this pull request Nov 20, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant