Bug#798919: apt: Acquire-By-Hash disables fallback for mirrors that lack it
Package: apt
Version: 1.1~exp12
Severity: normal
If an archive declares that it supports by-hash files using
"Acquire-By-Hash: true", then apt will *only* try to fetch the by-hash
versions; it is not able to fall back to the plain locations.
This makes Acquire-By-Hash unusable for large distributions that may
expect to have many mirrors some of which may not mirror the by-hash
files (I've been looking into implementing this in Launchpad for
Ubuntu); the mirrors cannot rewrite the Release file to remove this
flag, since they can't re-sign it. We can't expect users to fiddle with
APT::Acquire::$(host)::By-Hash on a per-host basis; the fallback needs
to be automatic.
Here's a failing integration test case:
diff --git a/test/integration/test-apt-by-hash-update b/test/integration/test-apt-by-hash-update
index cef46a1..7a27732 100755
--- a/test/integration/test-apt-by-hash-update
+++ b/test/integration/test-apt-by-hash-update
@@ -20,7 +20,8 @@ mkdir -p aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512
# add sources
mkdir -p aptarchive/dists/unstable/main/source/by-hash/SHA512
(cd aptarchive/dists/unstable/main/source/by-hash/SHA512 &&
- ln -s ../../Sources.gz $(sha512sum ../../Sources.gz|cut -f1 -d' ')
+ mv ../../Sources* . &&
+ ln -s Sources.gz $(sha512sum Sources.gz|cut -f1 -d' ')
)
# we moved the Packages file away, normal update won't work
@@ -49,3 +50,14 @@ rm -rf rootdir/var/lib/apt/lists
testsuccess aptget update -o Acquire::Languages=none
ensureitworks
+
+# simulate access via a mirror that does not mirror the by-hash files
+mv aptarchive/dists/unstable/main/binary-i386/by-hash/SHA512/Packages.gz \
+ aptarchive/dists/unstable/main/binary-i386/
+mv aptarchive/dists/unstable/main/source/by-hash/SHA512/Sources.gz \
+ aptarchive/dists/unstable/main/source/
+rm -rf aptarchive/dists/unstable/main/*/by-hash
+rm -rf rootdir/var/lib/apt/lists
+testsuccess aptget update -o Acquire::Languages=none
+
+ensureitworks
Thanks,
--
Colin Watson [cjwatson@ubuntu.com]
Reply to: