Skip to content

find: warn about useless -name/-wholename patterns - #812

Open
Xylphy wants to merge 1 commit into
uutils:mainfrom
Xylphy:fix/783-name-wholename-pattern-warnings
Open

find: warn about useless -name/-wholename patterns#812
Xylphy wants to merge 1 commit into
uutils:mainfrom
Xylphy:fix/783-name-wholename-pattern-warnings

Conversation

@Xylphy

@Xylphy Xylphy commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Fixes #783

Summary
This PR implements GNU-compatible warnings for find patterns that can never match anything, addressing issue #783.
Previously, uutils find silently accepted patterns like -name /a.txt or -wholename foo/, which will never produce matches. GNU find emits non-fatal warnings to help users catch these common mistakes early.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.19%. Comparing base (2a3eac9) to head (262d53e).

Files with missing lines Patch % Lines
src/find/matchers/mod.rs 91.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #812      +/-   ##
==========================================
+ Coverage   92.15%   92.19%   +0.03%     
==========================================
  Files          35       35              
  Lines        7377     7401      +24     
  Branches      383      386       +3     
==========================================
+ Hits         6798     6823      +25     
+ Misses        438      435       -3     
- Partials      141      143       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq

codspeed-hq Bot commented Aug 5, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing Xylphy:fix/783-name-wholename-pattern-warnings (262d53e) with main (2a3eac9)

Open in CodSpeed

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Commit b757e1f has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 313 / PASSED: 267 / FAILED: 40 / SKIPPED: 6
  Reference: TOTAL: 312 / PASSED: 266 / FAILED: 40 / SKIPPED: 6

Changes from main branch:
  TOTAL: +1
  PASSED: +1
  FAILED: +0

Emit non-fatal warnings at parse time for patterns that can never match,
matching GNU findutils behavior:

- Warn if a -name/-iname pattern contains a directory separator ('/'),
  since these predicates match against basenames only.
- Warn if a -path/-wholename/-ipath/-iwholename pattern ends with '/',
  since find never constructs paths with a trailing separator.
@sylvestre
sylvestre force-pushed the fix/783-name-wholename-pattern-warnings branch from b757e1f to 262d53e Compare August 18, 2026 17:21
Copilot AI lite review requested due to automatic review settings August 18, 2026 17:21

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

bug(find): do not warn when appending / to -name in the start or the end

2 participants