find: reject a signed -maxdepth/-mindepth value to match GNU - #835
Open
AlejandroCoronadoN wants to merge 2 commits into
Open
find: reject a signed -maxdepth/-mindepth value to match GNU#835AlejandroCoronadoN wants to merge 2 commits into
AlejandroCoronadoN wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #835 +/- ##
==========================================
+ Coverage 92.01% 92.07% +0.05%
==========================================
Files 35 35
Lines 7316 7316
Branches 378 378
==========================================
+ Hits 6732 6736 +4
+ Misses 442 438 -4
Partials 142 142 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Commit 2c18ead has test result changes: GNU findutils testsuite: bfs testsuite: |
Contributor
|
please add a test_find.rs |
convert_arg_to_number parsed the depth with Rust's usize parser, which accepts a leading '+', so "-maxdepth +1" was silently accepted. GNU find rejects a signed value there. Only accept plain decimal digits. Adds a test_find.rs test.
Contributor
Author
|
Done, added an integration test in test_find.rs for the signed -maxdepth/-mindepth case. |
AlejandroCoronadoN
force-pushed
the
fix-maxdepth-signed
branch
from
August 17, 2026 14:15
2c18ead to
e056014
Compare
|
Commit e056014 has test result changes: GNU findutils testsuite: bfs testsuite: |
|
Commit f9fbd6e has test result changes: GNU findutils testsuite: bfs testsuite: |
Contributor
|
a bunch of jobs have been failing |
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.
Problem
-maxdepth/-mindepthaccepted a+-signed value that GNU rejects:Rust's
usize::from_straccepts a leading+, soconvert_arg_to_numberletit through, which is inconsistent with the function's own "positive decimal
integer" error message.
Fix
Only accept plain decimal digits.
Verification
Compared against GNU findutils (
gfind) for-maxdepthand-mindepthover1,+1,-1,+2,0,2; exit codes match in every case. Added a unittest;
cargo test --libpasses andcargo fmt/cargo clippyare clean.