From 9872a227f1addb7fdc270bc0ed6da93b871e460f Mon Sep 17 00:00:00 2001 From: Ivan Teresenko Date: Thu, 27 Aug 2026 18:16:04 +0200 Subject: [PATCH 1/2] stat: print "Block size" in file system mode In `stat -f` the label was composed from two separate words, which rendered as "Block Size:". GNU prints "Block size:", so the label is now a single localizable string. As a side effect the French output becomes "Taille bloc:" instead of the word-by-word "Bloc Taille:". --- src/uu/stat/locales/en-US.ftl | 1 + src/uu/stat/locales/fr-FR.ftl | 1 + src/uu/stat/src/stat.rs | 7 +++---- tests/by-util/test_stat.rs | 10 ++++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/uu/stat/locales/en-US.ftl b/src/uu/stat/locales/en-US.ftl index c1acddfad0..3db5e503bb 100644 --- a/src/uu/stat/locales/en-US.ftl +++ b/src/uu/stat/locales/en-US.ftl @@ -90,6 +90,7 @@ stat-word-block = Block stat-word-size = Size stat-word-fundamental = Fundamental stat-word-block-size = block size +stat-word-block-size-capitalized = Block size stat-word-blocks = Blocks stat-word-total = Total stat-word-free = Free diff --git a/src/uu/stat/locales/fr-FR.ftl b/src/uu/stat/locales/fr-FR.ftl index 3c51a09c66..1d0f8038cd 100644 --- a/src/uu/stat/locales/fr-FR.ftl +++ b/src/uu/stat/locales/fr-FR.ftl @@ -73,6 +73,7 @@ stat-word-block = Bloc stat-word-size = Taille stat-word-fundamental = Fondamentale stat-word-block-size = taille bloc +stat-word-block-size-capitalized = Taille bloc stat-word-blocks = Blocs stat-word-total = Total stat-word-free = Libres diff --git a/src/uu/stat/src/stat.rs b/src/uu/stat/src/stat.rs index 4ad0005325..1e98f0e607 100644 --- a/src/uu/stat/src/stat.rs +++ b/src/uu/stat/src/stat.rs @@ -1428,15 +1428,14 @@ impl Stater { "%n %i %l %t %s %S %b %f %a %c %d\n".into() } else { format!( - " {}: \"%n\"\n {}: %-8i {}: %-7l {}: %T\n{} \ - {}: %-10s {} {}: %S\n{}: {}: %-10b \ + " {}: \"%n\"\n {}: %-8i {}: %-7l {}: %T\n{}: %-10s \ + {} {}: %S\n{}: {}: %-10b \ {}: %-10f {}: %a\n{}: {}: %-10c {}: %d\n", translate!("stat-word-file"), translate!("stat-word-id"), translate!("stat-word-namelen"), translate!("stat-word-type"), - translate!("stat-word-block"), - translate!("stat-word-size"), + translate!("stat-word-block-size-capitalized"), translate!("stat-word-fundamental"), translate!("stat-word-block-size"), translate!("stat-word-blocks"), diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 9e47c71277..95d86a0cde 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -52,6 +52,16 @@ fn test_fs_format() { ts.ucmd().args(&args).succeeds().stdout_is(expected_stdout); } +#[test] +#[cfg(unix)] +fn test_fs_default_format_block_size_label() { + // GNU prints "Block size:", not "Block Size:". + new_ucmd!() + .args(&["-f", "/"]) + .succeeds() + .stdout_contains("Block size:"); +} + #[cfg(unix)] #[test] fn test_terse_normal_format() { From 5614336a59314e1b41099831ff82d8b8aa95a9b8 Mon Sep 17 00:00:00 2001 From: Ivan Teresenko Date: Fri, 28 Aug 2026 09:38:14 +0200 Subject: [PATCH 2/2] stat: restrict the new fs-format test to linux and android `stat -f` panics with `unimplemented!()` in `fs_type` on the other unix targets, so the test failed on the OpenBSD leg of the unix job. --- tests/by-util/test_stat.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_stat.rs b/tests/by-util/test_stat.rs index 95d86a0cde..3144b56122 100644 --- a/tests/by-util/test_stat.rs +++ b/tests/by-util/test_stat.rs @@ -53,7 +53,9 @@ fn test_fs_format() { } #[test] -#[cfg(unix)] +// `stat -f` is only implemented for these targets; elsewhere `fs_type` is +// still `unimplemented!()`. +#[cfg(any(target_os = "linux", target_os = "android"))] fn test_fs_default_format_block_size_label() { // GNU prints "Block size:", not "Block Size:". new_ucmd!()