Skip to content

glob: match against the full path, not just the basename - #101

Merged
alpibrupa merged 1 commit into
mainfrom
fix-glob-path-matching
Sep 3, 2026
Merged

glob: match against the full path, not just the basename#101
alpibrupa merged 1 commit into
mainfrom
fix-glob-path-matching

Conversation

@alpibrupa

Copy link
Copy Markdown
Contributor

Found live during today's 4-agent pipeline run (audited via LEX_PERSIST_TRACE, #99): every agent that tried **/*.lex got "no files found" despite matching files existing.

Root cause: find -name only compares a pattern against a file's basename, so any pattern containing /**/*.lex, src/*, lex/specs/** — could never match anything. find reports this as an empty result, not an error, so there was no signal anything was wrong; every agent that hit it just burned a turn falling back to directory + non-recursive *.

Fix: -path instead of -name. BSD and GNU find both apply -path without FNM_PATHNAME, so * matches / too — handles the recursive-glob and nested-prefix forms models actually send, while behaving identically to -name for a plain slash-free pattern like *.lex.

Verified directly against a real tree with nested files under src/: **/*.lex now finds all of them, where it previously found none.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

find -name only compares a pattern against a file's basename, so any
pattern containing "/" — "**/*.lex", "src/*", "lex/specs/**" — could
never match anything: find silently reported "no files found" instead
of erroring, giving no signal anything was wrong.

Found live during today's 4-agent pipeline run (audited via
LEX_PERSIST_TRACE, #99): every agent that tried "**/*.lex" got "no
files found" despite matching files existing, and had to fall back to
directory + non-recursive "*" to find anything.

-path matches against the full path find is already walking (BSD and
GNU find both apply it without FNM_PATHNAME, so "*" matches "/" too),
which handles the recursive-glob and nested-prefix forms models
actually send while still behaving identically to -name for a plain
slash-free pattern like "*.lex" — verified directly: "**/*.lex" over a
tree with nested files under src/ now finds all of them, where it
previously found none.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@alpibrupa
alpibrupa merged commit f025950 into main Sep 3, 2026
1 check passed
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