Page MenuHomePhabricator

Use normal human units, not "correct" SI units, when parsing MB/GB etc
ClosedPublic

Authored by epriestley on Oct 2 2014, 8:34 PM.

Details

Summary

Technically, "KB" is "kilobyte" which is 1000 bytes, and "KiB" is "kibibyte" which is 1024 bytes. I implemented this function "correctly", but in practice we mostly use it to parse things from php.ini, mysql.cnf, etc., which all use units of 1024 intead of 1000. This ends up being really confusing because you write 128M in a file (technically meaning "128 mebibytes") and then a setup warning says 137M (technically meaning "137 megabytes").

Use the standard normal units that everyone and everything uses instead of the "correct" units. If we have some cause for the "real" SI units later we can mess with this stuff when we hit that.

Test Plan

Saw the setup check in D10630 actually report what I wrote in the file instead of a weird SI value.

Diff Detail

Repository
rPHU libphutil
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

epriestley retitled this revision from to Use normal human units, not "correct" SI units, when parsing MB/GB etc.
epriestley updated this object.
epriestley edited the test plan for this revision. (Show Details)
epriestley added a reviewer: btrahan.
chad added a reviewer: chad.
This revision is now accepted and ready to land.Oct 2 2014, 8:46 PM
This revision was automatically updated to reflect the committed changes.