-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
fix(stat): Collection of fixes for stat(1) #9078
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?
Conversation
Fixes issue uutils#9072, where some AppArmor profiles designed for GNU coreutils would break under uutils because we would fetch this info unnecessarily.
Fixes issue uutils#9071, where the default options for the `Device` field where incorrect, as well as several format flags that were not working as intended: %R, %Hr, %Lr, %Hd, %Ld, %t.
Previosuly, stat would ignore the next char after escaping it; e.g., "%%m" would become "%" instead of literally "%m".
CodSpeed Performance ReportMerging #9078 will degrade performances by 3.96%Comparing Summary
Benchmarks breakdown
Footnotes
|
|
I mean, that's not my fault lol. |
|
GNU testsuite comparison: |
|
I think it'd be better to add tests for the device number and the percent escape issues as well. For the percent escape issue, I propose the following addition to #[test]
fn test_double_percent() {
let ts = TestScenario::new(util_name!());
let result = ts.ucmd().args(&["-c", "%%m", "/"]).succeeds();
let output = result.stdout_str().trim();
assert!(!output.is_empty(), "Escaped percent should be present");
assert_eq!(output, "%m");
}For the device number format issue, I'd add |
|
Yeah I agree, I'll add a few tests :). Ngl, I was trying to cut that corner cuz tomorrow I got an exam, but it should be quick enough. |
|
Testing the value of these flags ( |
|
GNU testsuite comparison: |
|
Those CI fails are still not my fault :) Also, I'll probably be opening a few PRs with perf improvements, passes of clippy nightly, and I'll probably refactor stat's format parser so it's less spaghetti-y; iirc stat is not the only coreutil that does use percent escaping (ls, date, du and printf come to my mind) so I feel strongly like adding a general impl to |
This PR fixes #9071, #9072, as well as a few bugs found along the way.