]> git.ipfire.org Git - thirdparty/coreutils.git/commit
ls: fix alignment with locale formatted --size
authorPádraig Brady <P@draigBrady.com>
Sun, 31 Aug 2025 13:29:56 +0000 (14:29 +0100)
committerPádraig Brady <P@draigBrady.com>
Sun, 31 Aug 2025 18:25:38 +0000 (19:25 +0100)
commitebd670e7eb2d3e5c0dadac68efcf37f79958c4d5
tree6530020dfe4bbd17c5c60271f22dddc9c8cf3652
parent735a4a27f3d3a4bb3a0381c45b7deb936cc293c2
ls: fix alignment with locale formatted --size

Fix allocated size alignment in locales with multi-byte grouping chars.
Tested with: LC_ALL=sv_SE.utf8 ls --size --block-size=\'k

* src/ls.c (print_file_name_and_frills): Don't rely on
printf("%*s", width, string) to pad multi-byte strings appropriately.
Instead work out the padding required and use:
printf("%*s%s", padding, "", string) to pad multi-byte appropriately.
* tests/ls/block-size.sh: Add a test case.
* NEWS: Mention the bug fix.
Fixes https://bugs.gnu.org/79347
NEWS
src/ls.c
tests/ls/block-size.sh