You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lsd shows file size in non-si mebibytes/gibibytes (power of 2), while suggests it is megabytes/gigabytes (SI, power of 10).
In other words, the program should print 10 MiB instead of 10 MB.
Looking at gnu ls, it looks like they also use 1024 by default and uses 1000 when --si flag is provided. That said, the way they round it off is different.
$ truncate -s 126123520 foo
$ lsd -l foo
.rw-rw-r-- 120M now foo
$ ls -lh foo
-rw-rw-r-- 1 meain meain 121M Jan 19 10:29 foo
$ ls -lh --si foo
-rw-rw-r-- 1 meain meain 127M Jan 19 10:29 foo
$ cargo run -- -l foo # div by 1000
Compiling lsd v0.23.1 (/home/meain/dev/src/lsd)
Finished dev [unoptimized + debuginfo] target(s) in 2.27s
Running `target/debug/lsd -l foo`
.rw-rw-r-- 126M 14 seconds ago foo
From the man page:
-h, --human-readable
with -l and -s, print sizes like 1K 234M 2G etc.
--si likewise, but use powers of 1000 not 1024
We should also consider supporting the --si flag from gnu ls when we change this behavior.
lsd --version
: lsd 0.22.0lsd shows file size in non-si mebibytes/gibibytes (power of 2), while suggests it is megabytes/gigabytes (SI, power of 10).
In other words, the program should print 10 MiB instead of 10 MB.
Expected behavior
Actual behavior
126123520 bytes is 126 MB or 120 MiB.
The text was updated successfully, but these errors were encountered: