"Size" field in "Details" tab should show KiB units

Reported by Elliott Hughes on 2006-05-11
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gdebi
Fix Released
Low
Unassigned

Bug Description

the "Installed-Size" field is measured in KiB, but the gdebi-gtk GUI presents it as an unadorned number.

(congratulations on having the correct behavior when the field is missing from the package, though. apt-get incorrectly claims the package is 0 KiB in that case, despite having the package available!)

Elliott Hughes (enh) wrote :

here's a patch:

--- /usr/lib/python2.3/site-packages/GDebi/GDebi.py.orig 2006-05-11 17:19:56.000000000 -0700
+++ /usr/lib/python2.3/site-packages/GDebi/GDebi.py 2006-05-11 17:21:40.000000000 -0700
@@ -184,7 +184,7 @@
         self.label_maintainer.set_text(self._deb["Maintainer"])
         self.label_priority.set_text(self._deb["Priority"])
         self.label_section.set_text(self._deb["Section"])
- self.label_size.set_text(self._deb["Installed-Size"])
+ self.label_size.set_text(self._deb["Installed-Size"] + " KB")

         # set filelist
         buf = self.textview_filelist.get_buffer()

i've used "KB" like Nautilus, rather than the "KiB" recommended by "man units".

 --elliott

Michael Vogt (mvo) wrote :

Thanks for your bugreport and your patch.

I applied the patch to my bzr repository and it will be part of the next upload.

Changed in gdebi:
assignee: nobody → mvo
status: Unconfirmed → Fix Committed
Bruce Cowan (bruce89) on 2006-05-19
Changed in gdebi:
status: Fix Committed → Fix Released
Endolith (endolith) wrote :

apt/Synaptic and the Installed-Size parameter of .deb files all measure in decimal (1000s of bytes), so "KiB" would be wrong. "KB" is also wrong, though. It should be "kB".

http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Installed-Size

patch:

=== modified file 'GDebi/GDebi.py'
--- GDebi/GDebi.py 2008-08-05 14:24:05 +0000
+++ GDebi/GDebi.py 2008-09-03 02:00:11 +0000
@@ -221,7 +221,7 @@
         self.label_maintainer.set_text(utf8(self._deb["Maintainer"]))
         self.label_priority.set_text(self._deb["Priority"])
         self.label_section.set_text(utf8(self._deb["Section"]))
- self.label_size.set_text(self._deb["Installed-Size"] + " KB")
+ self.label_size.set_text(self._deb["Installed-Size"] + " kB")

         # set filelist
         buf = self.textview_filelist.get_buffer()

=== modified file 'GDebi/GDebiKDE.py'
--- GDebi/GDebiKDE.py 2008-08-05 14:23:57 +0000
+++ GDebi/GDebiKDE.py 2008-09-03 02:03:26 +0000
@@ -257,7 +257,7 @@
         self.DetailsMaintainer.setText(utf8(self._deb["Maintainer"]))
         self.DetailsPriority.setText(self._deb["Priority"])
         self.DetailsSection.setText(utf8(self._deb["Section"]))
- self.DetailsSize.setText(self._deb["Installed-Size"] + " KB")
+ self.DetailsSize.setText(self._deb["Installed-Size"] + " kB")

         # set filelist
         buf = self.IncFilesEdit

Changed in gdebi:
status: Fix Released → Confirmed

if that's true, the right fix isn't to pass APT's broken units on to the
user: the right fix is to convert kB into KiB, and display KiB. (the kB
figure's only approximate anyway. if they cared about accuracy, they'd
have given us B.)

something like this?

def kB_to_KiB(kB):
  return '%i KB' % round(float(kB)*1000.0/1024.0)

 --elliott

On Tue, September 2, 2008 19:07, Endolith wrote:
> apt/Synaptic and the Installed-Size parameter of .deb files all measure in
> decimal (1000s of bytes), so "KiB" would be wrong. "KB" is also wrong,
> though. It should be "kB".
>
> http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f
> -Installed-Size
>
>
> patch:
>
>
>
> === modified file 'GDebi/GDebi.py'
> --- GDebi/GDebi.py 2008-08-05 14:24:05 +0000
> +++ GDebi/GDebi.py 2008-09-03 02:00:11 +0000
> @@ -221,7 +221,7 @@
> self.label_maintainer.set_text(utf8(self._deb["Maintainer"]))
> self.label_priority.set_text(self._deb["Priority"])
> self.label_section.set_text(utf8(self._deb["Section"])) -
> self.label_size.set_text(self._deb["Installed-Size"] + " KB") +
> self.label_size.set_text(self._deb["Installed-Size"] + " kB")
>
> # set filelist
> buf = self.textview_filelist.get_buffer()
>
> === modified file 'GDebi/GDebiKDE.py'
> --- GDebi/GDebiKDE.py 2008-08-05 14:23:57 +0000
> +++ GDebi/GDebiKDE.py 2008-09-03 02:03:26 +0000
> @@ -257,7 +257,7 @@
> self.DetailsMaintainer.setText(utf8(self._deb["Maintainer"]))
> self.DetailsPriority.setText(self._deb["Priority"])
> self.DetailsSection.setText(utf8(self._deb["Section"])) -
> self.DetailsSize.setText(self._deb["Installed-Size"] + " KB") +
> self.DetailsSize.setText(self._deb["Installed-Size"] + " kB")
>
> # set filelist
> buf = self.IncFilesEdit
>
>
> ** Changed in: gdebi
> Status: Fix Released => Confirmed
>
>
> --
> "Size" field in "Details" tab should show KiB units
> https://bugs.launchpad.net/bugs/44286
> You received this bug notification because you are a direct subscriber
> of the bug.
>

--
Elliott Hughes, http://www.jessies.org/~enh/

Endolith (endolith) wrote :

"if that's true, the right fix isn't to pass APT's broken units on to the user"

No, apt's units are correct. .deb file units are correct too, and consistent with apt and derivatives, except that the symbol in GDebi should use lowercase k.

"the right fix is to convert kB into KiB, and display KiB."

No, KiB isn't appropriate for file sizes. Users expect to see thousands in this context. KiB is for things like memory and disk sectors that are inherently powers of two.

Russ Allbery (rra-debian) wrote :

The Installed-Size value is in KiB, not in 1000s of bytes. Look at the source of dpkg-gencontrol. It uses du -k, which produces output in KiB. At the time that Debian Policy was originally written, "kilobyte" nearly universally meant kibibyte.

Endolith (endolith) wrote :

It should probably be changed to 1000s then, to match Apt, Synaptic, and the rest. If you download a package that Apt/Synaptic lists as "12.4 kB" download size, the actual .deb is 12.4 kB = 12.1 KiB. Synaptic then reports the installed size as "77.8 kB", while GDebi reports the installed size as "76 KB" (76 KiB = 77.8 kB).

    5.6.20 Installed-Size

    This field appears in the control files of binary packages, and in the Packages files. It gives the total amount of disk space required to install the named package.

    The disk space is represented in kilobytes as a simple decimal number.

http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Installed-Size

It seems this number rarely matches the actual installed size, though. If you look at the total size of the installed files, it's often wildly off. Am I misunderstanding what it's for?

> At the time that Debian Policy was originally written, "kilobyte" nearly universally meant kibibyte.

I doubt that's true. Both the 1000 and 1024 meanings have been in common use for decades.

Changed in gdebi:
importance: Medium → Low
Endolith (endolith) on 2010-03-13
tags: added: units-policy
Luca Falavigna (dktrkranz) wrote :
Changed in gdebi:
assignee: Michael Vogt (mvo) → nobody
status: Confirmed → Fix Committed
Changed in gdebi:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Related blueprints