-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
nice -n huge_num true #10213
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
base: main
Are you sure you want to change the base?
nice -n huge_num true #10213
Conversation
eec8ae2 to
ae0c818
Compare
|
GNU testsuite comparison: |
4ce1311 to
7a75ddd
Compare
|
GNU testsuite comparison: |
fae9d13 to
0166306
Compare
|
GNU testsuite comparison: |
d7cd76f to
07d3f52
Compare
src/uu/nice/src/nice.rs
Outdated
| translate!("nice-error-invalid-number", "value" => nstr.clone(), "error" => e), | ||
| )); | ||
| // clamp huge values | ||
| let trimmed = nstr.trim(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think moving it into a function could help with readability
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this operation duplicated at somethere?
Merging this PR will degrade performance by 26.25%
Performance Changes
Comparing Footnotes
|
|
GNU testsuite comparison: |
27be172 to
b114e0a
Compare
|
GNU testsuite comparison: |
tests/by-util/test_nice.rs
Outdated
|
|
||
| #[test] | ||
| fn test_sign_middle() { | ||
| new_ucmd!().args(&["-n", "-2+4", "true"]).fails(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the error message?
|
GNU testsuite comparison: |
858f4f0 to
7d3c2ad
Compare
|
GNU testsuite comparison: |
src/uu/nice/src/nice.rs
Outdated
| format!("getpriority: {}", Error::last_os_error()), | ||
| )); | ||
| } | ||
| let nice_bound = 50; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hard-coded magic number 50 should be a named constant like MAX_NICE_OVERFLOW or similar
tests/by-util/test_nice.rs
Outdated
|
|
||
| #[test] | ||
| fn test_nice_huge_negative() { | ||
| new_ucmd!().args(&["-n", "-9999999999", "true"]).succeeds(); // permission denied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Negative overflow test should verify actual niceness value is clamped to expected bound
917605c to
34c2172
Compare
|
GNU testsuite comparison: |
Closes #10200