summaryrefslogtreecommitdiff
path: root/apt-pkg/pkgcache.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-01-16 18:19:34 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-01-16 18:21:20 +0100
commit25353dc6646e5b9fff55059a5c85183589cf472d (patch)
treeb10a58fe1cb2c4bc40e06fcd8471ac48556ecc2a /apt-pkg/pkgcache.cc
parentf3b5d3c47ba042ddf60588ce9d5185db902a7b55 (diff)
pkgcache.cc: Mix PACKAGE_VERSION into the cache hash
This ensures that caches build with one version can't be opened with another, which makes sense. It's a temporary approach until we can replace major:minor fields with a version string. For example, this would have prevented 1.9.7 from using broken caches from 1.9.6.
Diffstat (limited to 'apt-pkg/pkgcache.cc')
-rw-r--r--apt-pkg/pkgcache.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index f8ab423ae..59f4256ea 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -275,6 +275,10 @@ uint32_t pkgCache::CacheHash()
header.CacheFileSize = 0;
adler = hash32(adler,
+ reinterpret_cast<const unsigned char *>(PACKAGE_VERSION),
+ APT_ARRAY_SIZE(PACKAGE_VERSION));
+
+ adler = hash32(adler,
reinterpret_cast<const unsigned char *>(&header),
sizeof(header));