Skip to content

find's diagnostics are answered by the generic parser and operand handling: unknown predicates report 'unrecognized option' or 'invalid option -- b', and -D / -ignore_readdir_race are treated as missing file operands #1380

Closed

Description

@caomengxuan666

Probe-verified (same-source mingw+Wine harness, two runs, GNU findutils 4.9.0). find's own argument language is not owned by find: unknown input is answered by the generic option parser or falls through to file-operand handling, so users get diagnostics for a different program than the one they ran.

  1. find . --zzz → WinuxCmd: find: unrecognized option '--zzz' + Try-help line. GNU: find: unknown predicate '--zzz'.
  2. find . -bogus → WinuxCmd: find: invalid option -- 'b' — the generic parser even bundles the predicate and blames its first letter. GNU: find: unknown predicate '-bogus'.
  3. find -D tree . -name f → WinuxCmd: find: '-D': No such file or directory and find: 'tree': No such file or directory, exit 1 — -D is not recognized as a predicate at all and leaks into the path list. GNU: exit 0, evaluates, and prints the Predicate List / Eval Tree debug dump on stderr.
  4. find . -ignore_readdir_race -name f → WinuxCmd: find: '-ignore_readdir_race': No such file or directory, exit 1. GNU: accepted (a positional option), results print.
  5. find --debug . -name f → WinuxCmd: find: '--debug': No such file or directory. GNU: find: unknown predicate '--debug' — GNU find has no --debug long option; whatever the resolution, a missing-path error for an option-shaped token is the wrong diagnostic model.

Expected (GNU find)

Every token in predicate position is judged by find's own predicate table: known predicates (including the global/positional options -D, -ignore_readdir_race, -H/-L/-P/-O) take effect; anything else is an unknown predicate error from find itself.

Source

src/commands/find.cpp registers a hand-rolled predicate set but lets the shared parser (src/core/opt.cppm / dispatcher pre-passes) claim unknown --xxx tokens first, and unclaimed -x tokens fall into the operand list instead of an unknown-predicate error.

Regression seed

In-repo tests named with this issue number: the five probes above asserting diagnostic text, stream and exit code.

Activity

  1. added
    bug
    compat-gap
    on Oct 26, 2026
  2. added a commit that references this issue on Oct 27, 2026
  3. caomengxuan666 commented on Oct 27, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by #1400: unknown predicates are answered by find itself (find: unknown predicate '-zzz', verified on current main), and the global-option/start-point handling was reworked so parser diagnostics no longer swallow find's own operands. Regression pins issue_1380_* landed with the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcompat-gap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions