pr: exit with code 1 if --column argument is zero#11750
pr: exit with code 1 if --column argument is zero#11750Devel08 wants to merge 12 commits intouutils:mainfrom
Conversation
|
GNU testsuite comparison: |
|
Can we do that at same code path with |
|
@oech3 negative numbers are already handled, only numbers >= 0 could be used with |
|
Can you merge this logic to there? |
|
@oech3 That was my first plan. I would if I Could, but I can't manage to find where that check is done, close the PR if that solution isn't appropriate as I cannot propose any other fix than that. |
|
Lines 780 to 783 in 2ab8e25 parse_usize |
|
@oech3 yes, but parse_usize() is used for other purposes too, would it be safe to touch it? |
|
Maybe, this |
|
Maybe introduce a new function: fn parse_nonzero_usize(matches: &ArgMatches, opt: &str) -> Option<Result<NonZero<usize>, PrError>> |
|
@oech3, I put the exit in the match |
|
GNU testsuite comparison: |
|
What about the |
|
That -column mistake originates from the parse_usize() function |
This pull request closes #11584 where --column shouldn't be zero.
$ cargo run pr --column=0 /etc/pacman.conf/
pr: invalid -column argument '0'