From 7adf8c1fa8d519b8b57292763eb7703e7d3cc580 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 9 May 2022 11:42:48 +0200 Subject: Look at non by-hash paths in copy and file methods Ideally copy and file mirrors would support by-hash as well, but its harder to setup and maintain especially if you want to cache an online mirror who has by-hash enabled. We can avoid unneeded roundtrips (in the best case) and entire cache misses (in the usual worst case) by "just" telling methods that the URI we passed it has the requested file perhaps also in other paths. This is done in pseudo-relative paths as we would otherwise need to teach redirection code to rewrite those URIs as well. A method like http can easily ignore this value and await explicit instructions to look at that file, but inspecting the path in local sources via file or copy is (comparatively) free, so we just do it immediately. If that ends up being the wrong version of the file as by-hash would have protected us from we are in this feature branch now falling back to other mirrors which are like the ones online and in support of by-hash. --- test/integration/test-method-mirror | 1 - 1 file changed, 1 deletion(-) (limited to 'test/integration/test-method-mirror') diff --git a/test/integration/test-method-mirror b/test/integration/test-method-mirror index 1784e1ecb..79c675455 100755 --- a/test/integration/test-method-mirror +++ b/test/integration/test-method-mirror @@ -255,7 +255,6 @@ echo "file:/nonexistent/apt/archive priority:1 http://localhost:${APTHTTPPORT}/redirectme " > aptarchive/mirror.txt testsuccessequal "Get:1 foo+file:${APTARCHIVE}/mirror.txt Mirrorlist [$(stat -c%s 'aptarchive/mirror.txt') B] -Get:2 foo+file:/nonexistent/apt/archive unstable InRelease Ign:2 foo+file:/nonexistent/apt/archive unstable InRelease File not found - /nonexistent/apt/archive/dists/unstable/InRelease (2: No such file or directory) Hit:2 foo+http://localhost:${APTHTTPPORT}/redirectme unstable InRelease -- cgit v1.2.3-70-g09d2