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.

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.
@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 91.97%. Comparing base (1f19cdd) to head (b757e1f).

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   91.93%   91.97%   +0.04%     
==========================================
  Files          35       35              
  Lines        7251     7275      +24     
  Branches      378      381       +3     
==========================================
+ Hits         6666     6691      +25     
+ Misses        443      440       -3     
- Partials      142      144       +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 improve performance by 17.42%

⚡ 1 improved benchmark
✅ 19 untouched benchmarks

Performance Changes

Benchmark BASE HEAD Efficiency
printf 36.9 ms 31.4 ms +17.42%

Tip

Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Xylphy:fix/783-name-wholename-pattern-warnings (b757e1f) with main (1f19cdd)

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

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

1 participant