]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-595691-empty-and-broken-archive-files
test: Always install dpkg into our tests, regardless of MA
[apt.git] / test / integration / test-bug-595691-empty-and-broken-archive-files
CommitLineData
6874a1a8
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
6874a1a8
DK
6setupenvironment
7configarchitecture "i386"
8
9buildaptarchive
db4b5f77 10touch aptarchive/Packages
6874a1a8
DK
11setupflataptarchive
12
b2fd8524 13failureupdate() {
8de79b68 14 rm -rf rootdir/var/lib/apt
b2fd8524
DK
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
6874a1a8
DK
21}
22
4260fd39
DK
23createemptyarchive() {
24 find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
4260fd39 25 touch aptarchive/Packages
8bcbc694 26 echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS
b2fd8524 27 find aptarchive -name '*Release*' -delete
4260fd39
DK
28 rm -f aptarchive/Packages
29}
6874a1a8 30
4260fd39
DK
31createemptyfile() {
32 find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
4260fd39 33 touch aptarchive/Packages aptarchive/${1}.$COMPRESS
b2fd8524 34 find aptarchive -name '*Release*' -delete
4260fd39
DK
35 rm -f aptarchive/Packages
36}
6874a1a8 37
4260fd39 38testoverfile() {
1da3b7b8 39 local APTARCHIVE="$(readlink -f ./aptarchive)"
5f982b9d 40 forcecompressor "$1"
6874a1a8 41
b2fd8524 42 msgmsg 'archive over file' "Packages.$COMPRESS"
4260fd39 43 createemptyarchive 'Packages'
b2fd8524 44 successupdate
4260fd39 45 createemptyfile 'Packages'
b2fd8524 46 failureupdate "$(readlink -f rootdir/var/lib/apt/lists/partial/$(echo "$APTARCHIVE" | sed -e 's#/#_#g')_Packages.${COMPRESS})"
4260fd39 47}
6874a1a8 48
4260fd39 49testoverhttp() {
5f982b9d 50 forcecompressor "$1"
6874a1a8 51
b2fd8524 52 msgmsg 'archive over http' "Packages.$COMPRESS"
4260fd39 53 createemptyarchive 'Packages'
b2fd8524 54 successupdate
4260fd39 55 createemptyfile 'Packages'
b2fd8524 56 failureupdate "$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:${APTHTTPPORT}_Packages.${COMPRESS})"
4260fd39
DK
57}
58
912a6131 59forallsupportedcompressors testoverfile
4260fd39
DK
60
61# do the same again with http instead of file
62changetowebserver
6874a1a8 63
912a6131 64forallsupportedcompressors testoverhttp