[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#863635: apt-get upgrade --no-download --fix-missing: "How odd... The sizes didn't match"



On Mon, May 29, 2017 at 03:25:09PM +0200, Jakub Wilk wrote:
> apt-get reports size mismatch when I use --no-download --fix-missing:
> 
>    # apt-get upgrade --no-download --fix-missing
[…]
>    12 upgraded, 0 newly installed, 0 to remove and 10 not upgraded.
>    0,43868576
>    How odd... The sizes didn't match, email apt@packages.debian.org

We have a testcase which checks if such a call is successful, generates
error messages and such, so I wondered a bit whats up with your system
until I look at the output of the apt call under test…

Of course, given that this is one error message which doesn't look like
our usual error messages the framework isn't considering the message an
error and as the overall command is successful there is no problem…

Regression of sorts of eb1f04dda07c2b69549ad9fd793cca0e91841b3e (one
year old), but completely harmless as everything is as it should be, the
check is just buggy/pointless. Moving this and a few other checks out of
the way talking about downloads for cases in which we don't download
should solve this.

I doubt that bug qualifies as release critical for stretch, so I will
put it on my for-1.5 pile. Until that goes public, patch attached.


Best regards

David Kalnischkies
From 4c4e306a1be1e074ca07bec542c1469b909e2bfa Mon Sep 17 00:00:00 2001
From: David Kalnischkies <david@kalnischkies.de>
Date: Mon, 29 May 2017 18:02:28 +0200
Subject: [PATCH] don't show incorrect 'How odd' errror in no-download mode
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Showing messages related to downloading in a mode which can't download
is pretty pointless, so instead of trying harder to make it so that
these messages do not trigger just skip them entirely.

That the message triggered here is an artifact of the implementation in
which the download items are finished, while the code expects them to be
still pending – even the in a previous run completely downloaded files.

Closes: 863635
---
 apt-private/private-install.cc | 49 +++++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 22 deletions(-)

diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index 73a03a828..e37ff5390 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -109,6 +109,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
 	    Cache->MarkDelete(I,true);
 
    // Create the download object
+   auto const DownloadAllowed = _config->FindB("APT::Get::Download",true);
    aptAcquireWithTextStatus Fetcher;
    if (_config->FindB("APT::Get::Print-URIs", false) == true)
    {
@@ -136,7 +137,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
        _error->PendingError() == true)
       return false;
 
-   if (_config->FindB("APT::Get::Download",true) == false)
+   if (DownloadAllowed == false)
    {
       bool Missing = false;
       RemoveDownloadNeedingItemsFromFetcher(Fetcher, Missing);
@@ -218,27 +219,30 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
       return true;
    }
 
-   // Display statistics
-   auto const FetchBytes = Fetcher.FetchNeeded();
-   auto const FetchPBytes = Fetcher.PartialPresent();
-   auto const DebBytes = Fetcher.TotalNeeded();
-   if (DebBytes != Cache->DebSize())
+   auto const FetchBytes = DownloadAllowed ? Fetcher.FetchNeeded() : 0;
+   auto const FetchPBytes = DownloadAllowed ? Fetcher.PartialPresent() : 0;
+   if (DownloadAllowed)
    {
-      c0out << DebBytes << ',' << Cache->DebSize() << std::endl;
-      c0out << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl;
-   }
-   
-   // Number of bytes
-   if (DebBytes != FetchBytes)
-      //TRANSLATOR: The required space between number and unit is already included
-      // in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB
-      ioprintf(c1out,_("Need to get %sB/%sB of archives.\n"),
+      // Display statistics
+      auto const DebBytes = Fetcher.TotalNeeded();
+      if (DebBytes != Cache->DebSize())
+      {
+	 c0out << "E: " << DebBytes << ',' << Cache->DebSize() << std::endl;
+	 c0out << "E: " << _("How odd... The sizes didn't match, email apt@packages.debian.org") << std::endl;
+      }
+
+      // Number of bytes
+      if (DebBytes != FetchBytes)
+	 //TRANSLATOR: The required space between number and unit is already included
+	 // in the replacement strings, so %sB will be correctly translate in e.g. 1,5 MB
+	 ioprintf(c1out,_("Need to get %sB/%sB of archives.\n"),
 	       SizeToStr(FetchBytes).c_str(),SizeToStr(DebBytes).c_str());
-   else if (DebBytes != 0)
-      //TRANSLATOR: The required space between number and unit is already included
-      // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
-      ioprintf(c1out,_("Need to get %sB of archives.\n"),
+      else if (DebBytes != 0)
+	 //TRANSLATOR: The required space between number and unit is already included
+	 // in the replacement string, so %sB will be correctly translate in e.g. 1,5 MB
+	 ioprintf(c1out,_("Need to get %sB of archives.\n"),
 	       SizeToStr(DebBytes).c_str());
+   }
 
    // Size delta
    if (Cache->UsrSize() >= 0)
@@ -252,8 +256,9 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
       ioprintf(c1out,_("After this operation, %sB disk space will be freed.\n"),
 	       SizeToStr(-1*Cache->UsrSize()).c_str());
 
-   if (CheckFreeSpaceBeforeDownload(_config->FindDir("Dir::Cache::Archives"), (FetchBytes - FetchPBytes)) == false)
-      return false;
+   if (DownloadAllowed)
+      if (CheckFreeSpaceBeforeDownload(_config->FindDir("Dir::Cache::Archives"), (FetchBytes - FetchPBytes)) == false)
+	 return false;
 
    if (_error->PendingError() == true)
       return false;
@@ -362,7 +367,7 @@ bool InstallPackages(CacheFile &Cache,bool ShwKept,bool Ask, bool Safety)
 	 return false;
 
       Failed = false;
-      if (_config->FindB("APT::Get::Download",true) == false)
+      if (DownloadAllowed == false)
 	 RemoveDownloadNeedingItemsFromFetcher(Fetcher, Failed);
    }
 
-- 
2.11.0

Attachment: signature.asc
Description: PGP signature


Reply to: