Skip to content

dust shows IEC values with SI prefixes #570

@Zorbatron

Description

@Zorbatron

The manual shows these options for --output-format:

  • si
  • b
  • k - t for KiB - TiB (IEC)
  • kb - tb for KB - TB (SI)

To me, this implies that it defaults to SI prefixes, and the output using M or G suggests the same. However the reported sizes are actually using IEC prefixes and are "larger" when specifying -o si.

Testing with these files:

$ fallocate -l 1000000000 1GB.bin
$ fallocate -l 1G 1GiB.bin
$ fallocate -l 1000000 1MB.bin
$ fallocate -l 1M 1MiB.bin

eza shows the correct units:

$ eza -l --no-permissions --no-user --no-time (default is SI)
1.0G 1GB.bin
1.1G 1GiB.bin
1.0M 1MB.bin
1.0M 1MiB.bin

$ eza -l --no-permissions --no-user --no-time -b (for IEC prefixes)
954Mi 1GB.bin
1.0Gi 1GiB.bin
977Ki 1MB.bin
1.0Mi 1MiB.bin

$ eza -l --no-permissions --no-user --no-time -B (for plain byte count)
1,000,000,000 1GB.bin
1,073,741,824 1GiB.bin
    1,000,000 1MB.bin
    1,048,576 1MiB.bin

Whereas dust doesn't differentiate between SI and IEC:

$ dust -bo si
1.0M   ┌── 1MB.bin
1.0M   ├── 1MiB.bin
1.0G   ├── 1GB.bin
1.1G   ├── 1GiB.bin
2.1G ┌─┴ .

$ dust -b
980K   ┌── 1MB.bin
1.0M   ├── 1MiB.bin
953M   ├── 1GB.bin
1.0G   ├── 1GiB.bin
1.9G ┌─┴ .

$ dust -bo b
   1003520B   ┌── 1MB.bin
   1048576B   ├── 1MiB.bin
1000001536B   ├── 1GB.bin
1073741824B   ├── 1GiB.bin
2075795456B ┌─┴ .

(Idk why dust reads a wrong size for the SI files, eza, GNU ls, and GNU du don't do this)

When printing the sizes with IEC prefixes, it should be Ki/Mi/Gi/Ti. The man page should also mention that it defaults to IEC prefixes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions