thunar is dividing by 1000 rather than 1024 when converting file sizes to kilobytes, megabytes and gigabytes.
By definition kilo=10^3, mega=10^6, so this is not a bug.
AFAIR there was some talk about adding extra/optional binary prefixes (2^10, 2^20) but no one has stepped forward to implement it. Patches welcome.
the correct term is in base 2, as the correct units are bits, bytes, Kibibyte (KiB) mebibyte (MiB) gibibyte (GiB), etc..
I hope in the future, thunar show sizes in KiB MiB GiB etc
This is neither new, nor a bug. Please see Bug Report #9887.
Even though the Glib docs says we should use base 1000 to display "Network and storage sizes" I don't agree. They might have their rationale for this, but almost everything else displays KiB as KB(I know this is wrong) or at the best, they display file size as KiB. Even browsers(Firefox, Chromium...) and the majority of websites display KiB as KB. They are not ignorants or idiots, they're just not trying to confuse users.
All in all, I think that Thunar should use base 1024 notation, because it's not wrong and it's no confusing for the user, for example: "Oh, I downloaded this 60,4 MB file(the site and the browser told the user this), but Thunar says this is 63.3 MB". The funny thing is that if everybody is not following the standard, the one that follows is seen as wrong.
So, if I or someone else submit a patch in order to "fix" this, will TPTB accept?
André, I am thinking of two solutions:
1. Add a configuration option with a proper GUI and keep the defaults ("k"=10^3). Preferably, call the 2^10 prefix "Ki". If not, switch the column header name to "Size (binary)". In "Properties" dialogs and in the status bar use both systems (e.g. "9.7GB / 9.0GiB").
2. Use two column headers: "Size (decimal)", "Size (binary)" (we can already switch headers on/off). In "Properties" dialogs and in the status bar use both systems (e.g. "9.7GB / 9.0GiB").
If you implement either of these variants I will be happy to push it to master.
I guess the first one is more sensible, the second is too much clutter.
I'm tinkering the source, but I don't know how we could call this option:
"Use base 1024 for filesize"?
"Display filesize in IEC units"?
Also, where should this option be put? Preferences -> Display -> Default View? Or a new section in Display tab?
Thanks for taking this on. :D
I had seen this setting in Cinammon's Nemo file manager. In its 'Display' preferences tab, they had a section titled 'File Size' and then a field label 'Prefixes' next to a drop down menu which contained 'Decimal' and 'Binary'. I hope this helps.
Created attachment 5820
Finally I've come to have a spare time to work on this bug.
Besides the attached patch, here is the commit at my github repo:
I forgot to mention, this is just a preliminary patch, I'm not sure about the naming of the variables and strings. Also, preferences needs to be "getted" for each call to thunar_file_get_size_string, is there a better way to handle this?
Leave thunar_file_get_size_string unchanged and add another function e.g. thunar_file_get_size_string_with_mode (const ThunarFile *file, gboolean mode). Modify thunar-list-model.c (and any other code using thunar_file_get_size_string) to use the new function. Cache the configured value as a property in the ThunarListModel object.
Created attachment 5821
The patch has been updated following your recommendations. The github mirror is also up to date.
If you feel everything is good enough, I attach another patch with commit info.
I've merged your git branch into master. Thank you, that's a good quality code.
BTW, the status bar always uses decimal units. Also, the properties dialog could display both units at once - no need to make it configurable.
Thanks Andrzej for merging this so fast.
What do you mean by the status bar always showing sizes in decimal units?
If you set in preferences the check for binary format, after closing the dialog you need to selected another file to see the change.
Regarding the properties dialog, I guess it would be clutter to show sizes in binary units, decimal units *and bytes*, which is a hint for the size in kB, MB...
Should I mark this report as RESOLVED FIXED?
(In reply to Steve Dodier-Lazaro from comment #14)
> Should I mark this report as RESOLVED FIXED?
Yes ! you can, Thanks for all
I'm using Thunar from git for a while and so far I haven't spotted any problem.
It'd be great if someone else(besides me and Andrzej) could review the implementation, but if by any case someone notice a bug or an improvement, we can handle that in another bug report.
@Steve, I'm going ahead of you and closing this bug =)
I'm using Thunar from git too and all work perfect
Looking back at the patch, I don't think the misc-file-size-binary key is important enough to have a UI setting of its own (introduced in the patch). Any views on that?