lsd-rs / lsd-rs/lsd

Shows size power 2 (in MiB), but prints as if it is power 10 (MB)

Open
#807 2 comments 6 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
16.2k
Forks
510
PR merge metrics
No merged PRs in 30d

Description

- os: Fedora 37
- `lsd --version`: lsd 0.22.0

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 M**i**B instead of 10 **MB**.

## Expected behavior

```
$ lsd -la openwrt-22.03.3-x86-generic-generic-squashfs-combined-efi.img
.rw-r--r--. valdikss valdikss 120 M**i**B Wed Jan 18 19:17:34 2023 openwrt-22.03.3-x86-generic-generic-squashfs-combined-efi.img
```

## Actual behavior
```
$ lsd -la --size=bytes openwrt-22.03.3-x86-generic-generic-squashfs-combined-efi.img
.rw-r--r--. valdikss valdikss 126123520 Wed Jan 18 19:17:34 2023 openwrt-22.03.3-x86-generic-generic-squashfs-combined-efi.img

$ lsd -la openwrt-22.03.3-x86-generic-generic-squashfs-combined-efi.img
.rw-r--r--. valdikss valdikss 120 **MB** Wed Jan 18 19:17:34 2023 openwrt-22.03.3-x86-generic-generic-squashfs-combined-efi.img
```

126123520 bytes is 126 MB or 120 MiB.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with lsd's file-size display path and compare the default output with the --size=bytes option using the example image size from the issue. Verify that power-of-two values are labeled with binary units such as MiB rather than SI labels such as MB, while byte output remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.