[PR #571] fix: use IEC prefixes (Ki, Mi, Gi) for base-1024 size display #554

Open
opened 2026-06-08 11:29:22 +03:00 by zhus · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bootandy/dust/pull/571
Author: @ChihebBENCHEIKH1
Created: 4/17/2026
Status: 🔄 Open

Base: masterHead: fix/iec-unit-prefixes


📝 Commits (1)

  • 0a74f3b fix: use IEC prefixes (Ki, Mi, Gi) for base-1024 size display (#570)

📊 Changes

2 files changed (+87 additions, -71 deletions)

View changed files

📝 src/display.rs (+47 -31)
📝 tests/test_exact_output.rs (+40 -40)

📄 Description

Closes #570

dust calculates sizes using base-1024 (binary/IEC) by default but displays them with SI prefixes (K, M, G), which is misleading since SI prefixes imply powers of 1000.

Before: 1.0M (ambiguous — is this 1,000,000 or 1,048,576 bytes?)
After: 1.0Mi (clearly 1,048,576 bytes, base-1024)

SI mode (-o si) continues using K, M, G with base-1000 as expected.

Changes:

  • Replaced single UNITS array with SI_UNITS and IEC_UNITS
  • human_readable_number() and get_number_format() now select the correct suffix based on the output format
  • Updated all unit and integration tests

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bootandy/dust/pull/571 **Author:** [@ChihebBENCHEIKH1](https://github.com/ChihebBENCHEIKH1) **Created:** 4/17/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `fix/iec-unit-prefixes` --- ### 📝 Commits (1) - [`0a74f3b`](https://github.com/bootandy/dust/commit/0a74f3be8e385b055664577bc0341cf017fd36d0) fix: use IEC prefixes (Ki, Mi, Gi) for base-1024 size display (#570) ### 📊 Changes **2 files changed** (+87 additions, -71 deletions) <details> <summary>View changed files</summary> 📝 `src/display.rs` (+47 -31) 📝 `tests/test_exact_output.rs` (+40 -40) </details> ### 📄 Description Closes #570 dust calculates sizes using base-1024 (binary/IEC) by default but displays them with SI prefixes (K, M, G), which is misleading since SI prefixes imply powers of 1000. **Before:** `1.0M` (ambiguous — is this 1,000,000 or 1,048,576 bytes?) **After:** `1.0Mi` (clearly 1,048,576 bytes, base-1024) SI mode (`-o si`) continues using K, M, G with base-1000 as expected. **Changes:** - Replaced single `UNITS` array with `SI_UNITS` and `IEC_UNITS` - `human_readable_number()` and `get_number_format()` now select the correct suffix based on the output format - Updated all unit and integration tests --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
zhus added the pull-request label 2026-06-08 11:29:22 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bootandy/archived-dust#554