machine_readable_bytes() accepts invalid and misleading SI prefixes
Bug #1557839 reported by
Gavin Panella
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Invalid
|
Medium
|
Unassigned |
Bug Description
For example:
>>> machine_
1000000
>>> machine_
1000
>>> machine_
1000000000000000
I would expect:
>>> machine_
--> ValueError: smallest divisible unit is the byte.
>>> machine_
1024
>>> machine_
--> ValueError: smallest divisible unit is the byte.
To post a comment you must log in.
Hah. I had to check whether or not it was April Fools Day. What happens when you specify 1µ? ;-)
For the record, I think it's safe to assume that someone intended to write "megabyte", "kilobyte", or "terabyte". In other words, the current behavior is fine. If you believe the wiki, the standard is to use base 10 for storage sizes, which leaves little room for ambiguity.[1]
Unless, you know, you really did want me to allocate you that node with 1,000,000, 000,000, 000,000, 000,000 picobytes of storage.
[1]: https:/ /wiki.ubuntu. com/UnitsPolicy