Subject: bug#33757: 27.0.50; dired-du-mode displays incorrect human readable file sizes for non-GNU systems

From: Matthew Newton <[email-masked]>
Date: Fri, 14 Dec 2018 22:37:33 -0800

* Reproduction
1. Run MacOS (Or I suspect any OS that is not GNU-based).
2. emacs -Q
3. M-x package-install RET dired-du RET
4. M-x dired RET ~ RET
5. M-x dired-du-mode RET
6. Notice that file sizes are displayed in kbytes, not bytes (they are displayed in bytes in a GNU-based system)
7. M-x dired-du--toggle-human-readable RET
8. M-x z z (to enable file sizes displated in human readable form, i.e. sizes ending in k, M, G, T)
9. File sizes displayed are one order of magnitude smaller than their actual size (e.g. if the file size is 2MB then it will be displayed as 2kB)

* Discussion
The problem seems to arise when the custom variable dired-du-used-space-program is set. For a GNU-based system, it gets set to "du -sb" but for MacOS it gets set to "du -sk". Then later when the human readable sizes are calculated, this difference does not appear to be accounted for.

Why do we make the distinction between a GNU-based system and anything else? Can we just change the logic setting dired-du-used-space-program to always run "du -sb”?

Cheers,
Matt

P.S. This is my first Emacs bug report so please help me out if I should report it differently.