]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-bug-595691-empty-and-broken-archive-files
Don't download "optional" files not in Release :/.
[apt.git] / test / integration / test-bug-595691-empty-and-broken-archive-files
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6setupenvironment
7configarchitecture "i386"
8
9buildaptarchive
10touch aptarchive/Packages
11setupflataptarchive
12
13failureupdate() {
14 rm -rf rootdir/var/lib/apt
15 testfailure aptget update --allow-insecure-repositories
16 testsuccess grep "^E: Failed to fetch store:${1} Empty files can't be valid archives$" rootdir/tmp/testfailure.output
17}
18successupdate() {
19 rm -rf rootdir/var/lib/apt
20 testwarning aptget update --allow-insecure-repositories
21}
22
23createemptyarchive() {
24 find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
25 touch aptarchive/Packages
26 echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS
27 find aptarchive -name '*Release*' -delete
28 rm -f aptarchive/Packages
29}
30
31createemptyfile() {
32 find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
33 touch aptarchive/Packages aptarchive/${1}.$COMPRESS
34 find aptarchive -name '*Release*' -delete
35 rm -f aptarchive/Packages
36}
37
38testoverfile() {
39 local APTARCHIVE="$(readlink -f ./aptarchive)"
40 forcecompressor "$1"
41
42 msgmsg 'archive over file' "Packages.$COMPRESS"
43 createemptyarchive 'Packages'
44 successupdate
45 createemptyfile 'Packages'
46 failureupdate "$(readlink -f rootdir/var/lib/apt/lists/partial/$(echo "$APTARCHIVE" | sed -e 's#/#_#g')_Packages.${COMPRESS})"
47}
48
49testoverhttp() {
50 forcecompressor "$1"
51
52 msgmsg 'archive over http' "Packages.$COMPRESS"
53 createemptyarchive 'Packages'
54 successupdate
55 createemptyfile 'Packages'
56 failureupdate "$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:${APTHTTPPORT}_Packages.${COMPRESS})"
57}
58
59forallsupportedcompressors testoverfile
60
61# do the same again with http instead of file
62changetowebserver
63
64forallsupportedcompressors testoverhttp