GNU bug report logs - #79347
Bad formatting for ls with block-size 'k

Previous Next

Package: coreutils;

Reported by: Peter Laan <plaan70 <at> gmail.com>

Date: Sat, 30 Aug 2025 14:09:02 UTC

Severity: normal

Done: Pádraig Brady <P <at> draigBrady.com>

To reply to this bug, email your comments to 79347 AT debbugs.gnu.org.
There is no need to reopen the bug first.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-coreutils <at> gnu.org:
bug#79347; Package coreutils. (Sat, 30 Aug 2025 14:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Peter Laan <plaan70 <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-coreutils <at> gnu.org. (Sat, 30 Aug 2025 14:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Peter Laan <plaan70 <at> gmail.com>
To: bug-coreutils <at> gnu.org
Subject: Bad formatting for ls with block-size 'k
Date: Sat, 30 Aug 2025 10:15:11 +0200
[Message part 1 (text/plain, inline)]
Hi,

I'm a GNU/Linux noob so maybe I'm doing something wrong. But see the
attached image for badly formatted output from ls -s1 --block-size=\'k. The
columns are not always aligned. This only happens when you have large files
in the directory. Everything looks fine with --block-size=k.

I'm running Arch with the latest updates. ls version 9.7.
[Message part 2 (text/html, inline)]
[Skärmbild_20250830_100651-1.png (image/png, attachment)]

Reply sent to Pádraig Brady <P <at> draigBrady.com>:
You have taken responsibility. (Sun, 31 Aug 2025 13:37:02 GMT) Full text and rfc822 format available.

Notification sent to Peter Laan <plaan70 <at> gmail.com>:
bug acknowledged by developer. (Sun, 31 Aug 2025 13:37:02 GMT) Full text and rfc822 format available.

Message #10 received at 79347-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Peter Laan <plaan70 <at> gmail.com>, 79347-done <at> debbugs.gnu.org
Subject: Re: bug#79347: Bad formatting for ls with block-size 'k
Date: Sun, 31 Aug 2025 14:36:06 +0100
[Message part 1 (text/plain, inline)]
On 30/08/2025 09:15, Peter Laan wrote:
> Hi,
> 
> I'm a GNU/Linux noob so maybe I'm doing something wrong. But see the
> attached image for badly formatted output from ls -s1 --block-size=\'k. The
> columns are not always aligned. This only happens when you have large files
> in the directory. Everything looks fine with --block-size=k.
> 
> I'm running Arch with the latest updates. ls version 9.7.

The issue is that printf("*s", width, multi_byte_string) doesn't count
width appropriately. In your sv_SE.UTF-8 locale, the number grouping
character is 3 UTF8 bytes which messes up the alignment.

The attached should address this,
which I'll push later today.

Marking this as done.

thanks,
Padraig
[ls-block-align.patch (text/x-patch, attachment)]

This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.