Skip to content

find: Fix convert_arg_to_comparable_value() function parsing unexpected characters.#361

Merged
sylvestre merged 2 commits into
uutils:mainfrom
hanbings:fix-355
May 16, 2024
Merged

find: Fix convert_arg_to_comparable_value() function parsing unexpected characters.#361
sylvestre merged 2 commits into
uutils:mainfrom
hanbings:fix-355

Conversation

@hanbings

Copy link
Copy Markdown
Collaborator

convert_arg_to_comparable_value() as mentioned in #355 (comment) parses some strange characters.

The original regular expression was ([+-]?)(\d+)$ , which did a partial match and only included 1%2 of 2 as part of the match.
After adding the ^ limiter (^([+-]?)(\d+)$), the expression can be restricted to only match + - or 0-9.

@codecov

codecov Bot commented Apr 23, 2024

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 94.11765% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 58.88%. Comparing base (baa09ba) to head (c0b8cd0).

Files Patch % Lines
src/find/matchers/mod.rs 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #361      +/-   ##
==========================================
+ Coverage   58.34%   58.88%   +0.53%     
==========================================
  Files          30       30              
  Lines        3815     3831      +16     
  Branches      860      860              
==========================================
+ Hits         2226     2256      +30     
+ Misses       1257     1254       -3     
+ Partials      332      321      -11     

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

@sylvestre

Copy link
Copy Markdown
Contributor

please add integration tests too to trigger the error and make sure we are handling it correctly

@hanbings

hanbings commented Apr 24, 2024

Copy link
Copy Markdown
Collaborator Author

Thanks.
I added an command test for the -a/c/mtime directive in find_cmd_tests.rs.

But it may be that Codecov does not detect the diff because the PR only fixes regular expressions, so the coverage changes cannot be seen in the Codecov report.

@sylvestre sylvestre merged commit 70b7b36 into uutils:main May 16, 2024
@hanbings hanbings deleted the fix-355 branch May 24, 2024 13:35
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