Comment 9 for bug 410310

Revision history for this message
Manfred Hampl (m-hampl) wrote :

Almost all programs to download and update packages display the download size in 'decimal kilo' (e.g. synaptic, apt-get, gedbi-gtk, downloading window of update-manager). Most of these packages use the size_to_str function of apt/apt-pkg/strutl.cc. This function converts a value into a suitable smaller value with the SI multiplier character added (just 'K' or 'M' added), and does not add a 'B' for Bytes)

Only in update-manager the list of packages and the total size are expressed in 'binary kilo' size, using the function humanize_size defined in update-manager/UpdateManager/Core/utils.py. As far as I can see this program does not take into account the different decimal separator used in different languages. This Python script adds the 'B' for Bytes in the value returned.
Furthermore the humanize_size has an error that for KB values the remainder is cut off due to integer division (instead of using float division with rounding).

My proposal now is to get rid of humanize_size and use size_to_str in all parts of update-manager.
Just replacing the calls to humanize_size(value) in update-manager/UpdateManager/GTKProgress.py and update-manager/UpdateManager/GTKProgress.py by apt_pkg.size_to_str(value) is not enough because of the differences in adding 'B' for 'Bytes' respective its local language equivalent.