Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POSIX compliant globs #151

Merged
merged 5 commits into from
Mar 5, 2022
Merged

POSIX compliant globs #151

merged 5 commits into from
Mar 5, 2022

Conversation

tavianator
Copy link
Contributor

@tavianator tavianator commented Feb 24, 2022

This implements POSIX-compliant globs for -name, -lname, and the new -path. I couldn't find an existing crate that provided fnmatch() semantics exactly, so I implemented the conversion to POSIX regexes myself.

The glob crate exposes .gitignore style globs with recursive (**)
matching and other features.  find should implement globs exactly as
specified by POSIX.  Do this by translating them to POSIX Basic Regular
Expressions.

Fixes #140.
@tavianator
Copy link
Contributor Author

tavianator commented Feb 24, 2022

bfs

Changes from main: PASS +8 / SKIP -2 / FAIL -6

GNU

Changes from main: PASS +29 / FAIL -43 / ERROR +0 / SKIP +0

Windows tests are failing due to path separators, I'll fix it fixed

Now that -path/-ipath is implemented, no tests are skipped any more.
Fix CI by using zero instead of the empty string, which breaks the
compare_bfs_result.py script.
@codecov
Copy link

codecov bot commented Feb 24, 2022

Codecov Report

Merging #151 (ce375a7) into main (e18c369) will increase coverage by 0.53%.
The diff coverage is 85.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #151      +/-   ##
==========================================
+ Coverage   53.15%   53.68%   +0.53%     
==========================================
  Files          25       28       +3     
  Lines        4739     4802      +63     
  Branches     1561     1574      +13     
==========================================
+ Hits         2519     2578      +59     
- Misses       1671     1674       +3     
- Partials      549      550       +1     
Impacted Files Coverage Δ
src/find/main.rs 100.00% <ø> (ø)
src/find/matchers/regex.rs 48.78% <ø> (ø)
src/lib.rs 36.17% <ø> (+0.11%) ⬆️
src/find/matchers/mod.rs 63.44% <30.00%> (-1.77%) ⬇️
src/find/matchers/lname.rs 71.42% <71.42%> (ø)
src/find/matchers/glob.rs 95.31% <95.31%> (ø)
src/find/matchers/name.rs 100.00% <100.00%> (+20.45%) ⬆️
src/find/matchers/path.rs 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e18c369...ce375a7. Read the comment docs.

@sylvestre
Copy link
Contributor

Impressive!

@sylvestre sylvestre merged commit 4cd4e4f into uutils:main Mar 5, 2022
@tavianator tavianator deleted the globs branch March 5, 2022 20:05
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.

2 participants