glob: match against the full path, not just the basename - #101
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Found live during today's 4-agent pipeline run (audited via
LEX_PERSIST_TRACE, #99): every agent that tried**/*.lexgot"no files found"despite matching files existing.Root cause:
find -nameonly compares a pattern against a file's basename, so any pattern containing/—**/*.lex,src/*,lex/specs/**— could never match anything.findreports 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 todirectory+ non-recursive*.Fix:
-pathinstead of-name. BSD and GNUfindboth apply-pathwithoutFNM_PATHNAME, so*matches/too — handles the recursive-glob and nested-prefix forms models actually send, while behaving identically to-namefor a plain slash-free pattern like*.lex.Verified directly against a real tree with nested files under
src/:**/*.lexnow finds all of them, where it previously found none.Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com