Skip to content

stat: print "Block size" in file system mode - #14188

Open
Socialpranker wants to merge 2 commits into
uutils:mainfrom
Socialpranker:stat-fs-block-size
Open

stat: print "Block size" in file system mode#14188
Socialpranker wants to merge 2 commits into
uutils:mainfrom
Socialpranker:stat-fs-block-size

Conversation

@Socialpranker

Copy link
Copy Markdown

stat -f builds its second line out of two independent word translations,
stat-word-block (Block) and stat-word-size (Size), so the label comes
out capitalized on both words:

$ stat -f /etc/passwd            # this build
  File: "/etc/passwd"
    ID: 1f5177f6d898479e Namelen: 255     Type: overlayfs
Block Size: 4096       Fundamental block size: 4096
Blocks: Total: 118523922  Free: 116434161  Available: 110395109
Inodes: Total: 30179328   Free: 29976433

GNU prints Block size: there — lowercase s, one label rather than two
words. Everything else on the line, including the %-10s padding and the
Fundamental block size: label that follows, already matches.

This PR replaces the Block + Size pair with a single localizable key,
stat-word-block-size-capitalized. Composing a label out of separate words is
also a translation hazard: the French locale currently renders Bloc Taille:,
and with the label as one string it becomes Taille bloc:. The existing
stat-word-block and stat-word-size keys stay — they are still used for
IO Block: and Size: in the non--f format.

Testing: new test_fs_default_format_block_size_label in
tests/by-util/test_stat.rs asserts the label; it fails on current main and
passes with this change (verified by reverting stat.rs and the locales alone
and re-running). The full stat suite is green (33 passed),
cargo fmt --all --check and cargo clippy -p uu_stat --all-targets are
clean. A release build of this branch was also compared against the system
stat inside debian:stable-slim for /, /etc, /etc/passwd, /tmp,
/proc and /dev — 6 of 6 byte-identical, where before all six differed on
this line.

Behaviour was established by observing GNU stat's output on a Debian system —
no GNU source was consulted.

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:".
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/tail/inotify-dir-recreate (fails in this run but passes in the 'main' branch)
Skipping an intermittent issue tests/cut/bounded-memory (passes in this run but fails in the 'main' branch)
Note: The gnu test tests/printf/printf-surprise is now being skipped but was previously passing.
Congrats! The gnu test tests/tail/tail-n0f is now passing!

`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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant