colorls icon indicating copy to clipboard operation
colorls copied to clipboard

[bug] rounding for small files

Open juanMarinero opened this issue 8 months ago • 0 comments

Please read: Rounding bug for large files #600 and its #622 PR.

Human-readable rounds wrong the file size in small files. In this case to 1KiB instead to 2KiB (1731 ÷ 1024 = 1.69 → should round up to 2)

> colorls -l settings.vim
   rw-rw----   1   user   user      1 KiB   Thu Apr 17 12:43:33 2025    settings.vim 
> colorls -l -h settings.vim
   rw-rw----   1   user   user      1 KiB   Thu Apr 17 12:43:33 2025    settings.vim 

--no-human-readable works fine

> colorls -l --no-human-readable settings.vim
   rw-rw----   1   user   user   1731 B   Thu Apr 17 12:43:33 2025    settings.vim

Both ls -l and stat confirm it

> ls -l settings.vim
-rw-rw---- 1 user user 1731 Apr 17 12:43 settings.vim
> stat settings.vim
  File: settings.vim
  Size: 1731      	Blocks: 8          IO Block: 4096   regular file
  [...]

Request. If possible show 1 decimal precision (alike 1.7 KiB), otherwise proper round to the right natural value please. Thanks in advance!

colorls --version: 1.5.0 OS: 24.04.1-Ubuntu

juanMarinero avatar May 03 '25 08:05 juanMarinero