From e45417c4767c2e54def08f52d55350ed0651d95a Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 10 Jun 2021 12:51:45 +0200 Subject: Use full item description in broken repo error The error says the repository is broken but doesn't mention which one it is. The item description gives us at least all the information, but is not as nicely formatted. As this message is not even marked for translation this is a rather temporary affair and we can survive without the eye candy for a while. --- apt-pkg/acquire-item.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index d6ffaf34d..37a715390 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -3471,9 +3471,8 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc } if (FileSize == 0 && not _config->FindB("Acquire::AllowUnsizedPackages", false)) { - _error->Error("Repository is broken: %s (= %s) has no Size information", - Version.ParentPkg().FullName(false).c_str(), - Version.VerStr()); + _error->Error("Repository is broken: %s has no Size information", + Desc.Description.c_str()); return; } -- cgit v1.2.3-70-g09d2 From 7adecd8b2543fc8ee5288b91525a366cf9525cb8 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 10 Jun 2021 12:58:24 +0200 Subject: Store size from volatile sources for already installed versions Volatile sources are parsed after the status file, so if we have a version already installed the size information is not stored, so that a reinstall of said version is refused claiming a broken repository. References: 1412cf51403286e9c040f9f86fd4d8306e62aff2 --- apt-pkg/deb/deblistparser.cc | 7 ++++++- test/integration/test-apt-get-install-deb | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index d0f0838d0..966246ca7 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -404,8 +404,13 @@ uint32_t debListParser::VersionHash() half-configured, triggers-awaited, triggers-pending, installed */ bool debListParser::ParseStatus(pkgCache::PkgIterator &, - pkgCache::VerIterator &) + pkgCache::VerIterator &Ver) { + // the status file has no info about the download size and + // usually this is fine as we will have picked that info up already – + // except if we have volatile sources which are parsed after the status file. + if (Ver->Size == 0) + Ver->Size = Section.FindULL(pkgTagSection::Key::Size); return true; } bool debStatusListParser::ParseStatus(pkgCache::PkgIterator &Pkg, diff --git a/test/integration/test-apt-get-install-deb b/test/integration/test-apt-get-install-deb index 3d0b9a80d..56963819a 100755 --- a/test/integration/test-apt-get-install-deb +++ b/test/integration/test-apt-get-install-deb @@ -7,6 +7,9 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture 'amd64' 'i386' +# XXX: Remove temporary hack +rm rootdir/etc/apt/apt.conf.d/temporary-allow-unsized-packages + # regression test for #754904 cat > foo.rpm <