blob: dec9383c9b0817a08f85a3348651a9231f4b619c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
#!/bin/sh
set -e
TESTDIR="$(readlink -f "$(dirname "$0")")"
. "$TESTDIR/framework"
setupenvironment
configarchitecture "amd64"
configcompression 'gz'
insertpackage 'unstable' 'foo' 'amd64' '1'
setupaptarchive --no-update
testfailure aptcache show foo
# the Release file says gz available, but the mirror has only uncompressed files
find aptarchive/dists -name '*.gz' -delete
testsuccess apt update
testsuccess aptcache show foo
testfailure aptcache show bar
testsuccess apt update
rm -rf rootdir/var/lib/apt/lists
msgmsg 'File mirror was hacked'
mkdir aptarchive2
cp -a aptarchive/dists aptarchive2/
rm -rf rootdir/var/lib/apt/lists
find aptarchive/dists -name 'Packages' | while read FILE; do
echo 'hacked' > $FILE
done
testfailure apt update -o Debug::pkgAcquire::Worker=1
testsuccessequal '4' grep -c -- '- Filesize:' rootdir/tmp/testfailure.output
testsuccessequal '2' grep -c '%0aAlt-Checksum-FileSize-Hash:%20' rootdir/tmp/testfailure.output
echo 'Acquire::By-Hash "force";' > rootdir/etc/apt/apt.conf.d/99force-by-hash.conf
msgmsg 'Fallback over hashsum errors'
rm -f rootdir/etc/apt/sources.list rootdir/etc/apt/sources.list.d/*
echo "deb mirror+file:${TMPWORKINGDIRECTORY}/mirror.list unstable main" > rootdir/etc/apt/sources.list
rm -rf rootdir/var/lib/apt/lists
cat > mirror.list <<EOF
copy:${TMPWORKINGDIRECTORY}/aptarchive priority:1
file:${TMPWORKINGDIRECTORY}/aptarchive2 priority:2
EOF
testsuccess apt update
cp -a rootdir/tmp/testsuccess.output aptupdate.log
testsuccessequal '2' grep -c -- '^Ign:' aptupdate.log
rm -rf rootdir/var/lib/apt/lists
cat > mirror.list <<EOF
file:${TMPWORKINGDIRECTORY}/aptarchive priority:1
copy:${TMPWORKINGDIRECTORY}/aptarchive2 priority:2
EOF
testsuccess apt update
rm -rf rootdir/var/lib/apt/lists
cat > mirror.list <<EOF
file:${TMPWORKINGDIRECTORY}/aptarchive priority:1
file:${TMPWORKINGDIRECTORY}/aptarchive2 priority:2
EOF
testsuccess apt update
cp -a rootdir/tmp/testsuccess.output aptupdate.log
testsuccessequal '1' grep -c -- '^Ign:' aptupdate.log
|