[Aptitude-devel] Bug#759769: aptitude: Installed Size diff reported wrong for packages larger 2GiB if installed

Sven Joachim svenjoac at gmx.de
Thu Sep 25 17:21:56 UTC 2014


Control: tags -1 +patch

On 2014-09-11 21:38 +0200, Jason Rhinelander wrote:

> On Sat, 30 Aug 2014 07:52:54 +0200 Benny Baumann <BenBE at geshi.org> wrote:
>> To reproduce have a look at the linux-image-*-dbg packages that require
>> more than 2GiB on amd64 after installation. When installing such a package
>> aptitude will report something like "pi linux-image-*-dbg   -1,900M ..."
>> while the correct display would report +2300M instead.
>>
>> Likewise uninstalling such a package will report something along the lines
>> of "id linux-image-*-dbg   +1,900M" where "-2,300M" would be correct.
>
> Just to clarify the above, it's only the disk usage on the individual
> package line that is incorrect: the overall total near the top of the
> interface ("Will use xxx MB of disk space") is correct.

Also the output on the commandline with the -Z option is affected.

> libreoffice-dbg is another such package (showing -870MB when selected
> for installation instead of the correct +3,425MB).

The following patch fixes both occurrences by changing the type of the
offending variable (InstalledSize is declared as unsigned long long in
/usr/include/apt-pkg/pkgcache.h):

--8<---------------cut here---------------start------------->8---
diff --git a/src/cmdline/cmdline_prompt.cc b/src/cmdline/cmdline_prompt.cc
index 292acf6..1c0442c 100644
--- a/src/cmdline/cmdline_prompt.cc
+++ b/src/cmdline/cmdline_prompt.cc
@@ -352,7 +352,7 @@ static void cmdline_show_instinfo(pkgvector &items,
       // Show the change in size between the versions.
       if(showsize)
 	{
-	  int dsize=(instver.end()?0:instver->InstalledSize)
+	  long long dsize=(instver.end()?0:instver->InstalledSize)
 	    -(i->CurrentVer().end()?0:i->CurrentVer()->InstalledSize);
 
 	  if(dsize>0)
diff --git a/src/pkg_columnizer.cc b/src/pkg_columnizer.cc
index 7642775..f85733a 100644
--- a/src/pkg_columnizer.cc
+++ b/src/pkg_columnizer.cc
@@ -161,7 +161,7 @@ cw::column_disposition pkg_item::pkg_columnizer::setup_column(const pkgCache::Pk
 	  pkgCache::VerIterator inst_ver=(*apt_cache_file)[pkg].InstVerIter(*apt_cache_file);
 
 	  // TODO: move this to a generic file (common with cmdline.cc)
-	  int dsize=(inst_ver.end()?0:inst_ver->InstalledSize)
+	  long long dsize=(inst_ver.end()?0:inst_ver->InstalledSize)
 	    -(pkg.CurrentVer().end()?0:pkg.CurrentVer()->InstalledSize);
 
 	  if(dsize==0)
--8<---------------cut here---------------end--------------->8---

Cheers,
       Sven



More information about the Aptitude-devel mailing list