diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-09 18:16:10 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-13 16:00:41 +0200 |
commit | 1412cf51403286e9c040f9f86fd4d8306e62aff2 (patch) | |
tree | 723c7b1f1314ab0a2331af56f48587b008d50616 /apt-pkg | |
parent | 27a4fb3a9ac67a13ed516c75feefdc1fd426520a (diff) |
Error on packages without a Size field (option Acquire::AllowUnsizedPackages)
Repositories without Size information for packages are not
proper and need fixing. This ensures people see an error in
CI, and get notifications and hence the ability to fix it.
It can be turned off by setting Acquire::AllowUnsizedPackages
to true.
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/acquire-item.cc | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index ab4306aac..2bab7d5c0 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -3469,6 +3469,13 @@ pkgAcqArchive::pkgAcqArchive(pkgAcquire *const Owner, pkgSourceList *const Sourc Version.VerStr(), Version.ParentPkg().FullName(false).c_str()); return; } + 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()); + return; + } // Check if we already downloaded the file struct stat Buf; |