diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index 88af56bb1..cba9cdf53 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -3228,7 +3228,7 @@ fn calculate_padding_collection( padding_collections.minor = minor_len.max(padding_collections.minor); padding_collections.size = size_len .max(padding_collections.size) - .max(padding_collections.major + padding_collections.minor + 2usize); + .max(padding_collections.major); } } } diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index 07ea8c9cd..19a3f5578 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -1023,6 +1023,21 @@ fn test_ls_long_format() { ).unwrap()); } +#[test] +fn test_ls_long_padding_of_size_column_with_multiple_files() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("dir"); + at.touch("dir/a"); + at.touch("dir/b"); + + ucmd.arg("-l") + .arg("dir") + .succeeds() + .stdout_contains(" 0 ") + .stdout_does_not_contain(" 0 "); +} + /// This test tests `ls -laR --color`. /// This test is mainly about coloring, but, the recursion, symlink `->` processing, /// and `.` and `..` being present in `-a` all need to work for the test to pass.