Bug 673649 - Conversion from bytes to Gbytes is not properly performed
Summary: Conversion from bytes to Gbytes is not properly performed
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: gnome-disk-utility
Version: 14
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: David Zeuthen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-01-29 09:59 UTC by Xavi
Modified: 2013-03-06 04:06 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-02-01 22:22:13 UTC
Type: ---


Attachments (Terms of Use)
Screenshot were the wrong values can be seen (146.59 KB, image/png)
2011-01-29 09:59 UTC, Xavi
no flags Details

Description Xavi 2011-01-29 09:59:27 UTC
Created attachment 475935 [details]
Screenshot were the wrong values can be seen

Description of problem:

Capacity value shown is incorrect. The conversion from bytes to Gbytes is performed incorrectly. It shows 66571993088 bytes corresponds to 67 GB, when the correct value is 62 GB. See attached screenshot for details

Version-Release number of selected component (if applicable):

N/A

How reproducible:

Displaying size of any of the volumes and/or partitions of the system

Steps to Reproduce:
1. Open disk utility
2. Select any disk
3. See size
  
Actual results:

Conversion from bytes to Gbytes is not properly performed

Expected results:

The conversion should be: bytes/1024/1024/1024

Additional info:

Comment 1 Andre Robatino 2011-01-29 22:38:43 UTC
http://en.wikipedia.org/wiki/Binary_prefixes

1 GB = 10^9 bytes
1 GiB = 2^30 bytes

Note in the upper right of your image, the explicit use of IEC units (MiB) as opposed to SI units (MB). The possible confusion could be avoided by giving _all_ sizes in IEC units, but it's customary for HDD and DVD sizes to be given in SI units.

Comment 2 David Zeuthen 2011-02-01 22:22:13 UTC
The decision in Palimpsest is to use SI units _except_ for things that are always going to be powers of two. Such as RAID stripes.

This decision was made because most hard-disk vendors use SI units and it would look weird having the OS show 931GB while the packaging for that new hard disk says '1 TB' or '1000 GB'.

Closing as NOTABUG.

Comment 3 David Zeuthen 2011-02-01 22:24:36 UTC
Didn't mean to reassign to 0xFFFF (my browser did that on its own). Reassigning back.

Comment 4 David Woodhouse 2011-02-02 08:56:46 UTC
(In reply to comment #2)
> The decision in Palimpsest is to use SI units _except_ for things that are
> always going to be powers of two. Such as RAID stripes.
> 
> This decision was made because most hard-disk vendors use SI units and it would
> look weird having the OS show 931GB while the packaging for that new hard disk
> says '1 TB' or '1000 GB'.

It wouldn't say 931GB, surely? It would say 931GiB.

Make the choice of whether to use power-of-ten units or power-of-two units as you see fit, of course. As long as you always use the correct label. Never use power-of-two units but actually *label* it as power-of-ten... or vice versa, although that's less likely.

Comment 5 David Zeuthen 2011-02-02 15:53:05 UTC
(In reply to comment #4)
> (In reply to comment #2)
> > The decision in Palimpsest is to use SI units _except_ for things that are
> > always going to be powers of two. Such as RAID stripes.
> > 
> > This decision was made because most hard-disk vendors use SI units and it would
> > look weird having the OS show 931GB while the packaging for that new hard disk
> > says '1 TB' or '1000 GB'.
> 
> It wouldn't say 931GB, surely? It would say 931GiB.

Right, except..

> Make the choice of whether to use power-of-ten units or power-of-two units as
> you see fit, of course. As long as you always use the correct label. Never use
> power-of-two units but actually *label* it as power-of-ten... or vice versa,
> although that's less likely.

Unless you are using JEDEC units [1] in which case it actually would say "931 GB". That's how Windows does it. And how GNOME's file manager, Nautilus, does it. And the way GLib's g_format_size_for_display() does it. Which is so broken that it's not even funny...

[1] : http://en.wikipedia.org/wiki/JEDEC_memory_standards

Comment 6 David Woodhouse 2011-02-02 15:55:22 UTC
That's totally fucked in the head. Got GNOME bug numbers for those?

Comment 7 David Zeuthen 2011-02-02 16:20:25 UTC
(In reply to comment #6)
> That's totally fucked in the head. Got GNOME bug numbers for those?

Yeah, it's https://bugzilla.gnome.org/show_bug.cgi?id=554172 and there's about a 100 comments. Not sure it's helpful to post to that bug; everyone, including myself, just don't want to talk about it anymore. It's gotten to that. I think the only thing there is some agreement about is that g_format_size_for_display() should be deprecated since choosing units imply policy decisions or crap like that etc.


Note You need to log in before you can comment on or make changes to this bug.