format_bytes_for_user prints KB/MB/GB for base-1024 math
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 40
- Forks
- 9
- Avg merge
- 4d 20h
- Merged PRs (30d)
- 59
Description
Problem
format_bytes_for_user (apps/rocm/src/main.rs) divides by 1024 but labels the result KB, MB, GB. The units say base 1000; the arithmetic is base 1024, so every figure it prints is mislabelled.
format_bytes, used by rocm storage, does the same arithmetic and prints KiB, MiB, GiB. Two size formatters with the same maths and different units now both appear in user-facing output.
Suggested direction
Pick one and use it everywhere: either correct the units on format_bytes_for_user to the Ki/Mi/Gi forms, or make it genuinely base 1000. Then collapse the two functions so there is a single size formatter.
Context
Out of scope for #172, which only made format_bytes live and fixed its rounding at unit boundaries. format_bytes_for_user reaches unrelated call sites, so changing its output belongs in its own change. Raised from review feedback on that PR.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in apps/rocm/src/main.rs by reading format_bytes_for_user and format_bytes, then trace their user-facing call sites. Choose one unit convention and consolidate the two formatters without changing the scope of #172. Done means both paths use one formatter with arithmetic and labels that agree.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100