]> git.saurik.com Git - apt.git/blame - test/integration/test-bug-595691-empty-and-broken-archive-files
releasing version 0.8.7
[apt.git] / test / integration / test-bug-595691-empty-and-broken-archive-files
CommitLineData
6874a1a8
DK
1#!/bin/sh
2set -e
3
9962ae93 4TESTDIR=$(readlink -f $(dirname $0))
6874a1a8
DK
5. $TESTDIR/framework
6setupenvironment
7configarchitecture "i386"
8
9buildaptarchive
10setupflataptarchive
11
12testaptgetupdate() {
13 aptget update 2>> testaptgetupdate.diff >> testaptgetupdate.diff || true
1054d76b 14 sed -i -e '/^Fetched / d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.diff
6874a1a8
DK
15 GIVEN="$1"
16 shift
17 msgtest "Test for correctness of" "apt-get update with $*"
18 if [ -z "$GIVEN" ]; then
19 echo -n "" | checkdiff - testaptgetupdate.diff && msgpass || msgfail
20 else
21 echo "$GIVEN" | checkdiff - testaptgetupdate.diff && msgpass || msgfail
22 fi
23 rm testaptgetupdate.diff
24}
25
26touch aptarchive/en.bz2
27
28testaptgetupdate "Ign file: Release.gpg
29Ign file:$(readlink -f aptarchive)/ Translation-en
30Get:1 file: Release []
31Reading package lists..." "empty file en.bz2 over file"
32
33rm aptarchive/en.bz2
34echo -n "" | bzip2 > aptarchive/en.bz2
35
36testaptgetupdate "Ign file: Release.gpg
37Get:1 file: Release []
38Reading package lists..." "empty archive en.bz2 over file"
39
40rm aptarchive/en.bz2
41
42# do the same again with http instead of file
43changetowebserver
44
45touch aptarchive/en.bz2
46
47testaptgetupdate "Ign http://localhost Release.gpg
48Get:1 http://localhost/ Translation-en
49Get:2 http://localhost Release []
50Ign http://localhost/ Translation-en
51Get:3 http://localhost Packages []
52Reading package lists..." "empty file en.bz2 over http"
53
54rm aptarchive/en.bz2
55echo -n "" | bzip2 > aptarchive/en.bz2
56
57testaptgetupdate "Ign http://localhost Release.gpg
58Get:1 http://localhost/ Translation-en []
59Get:2 http://localhost Release []
60Ign http://localhost Packages/DiffIndex
61Get:3 http://localhost Packages []
62Reading package lists..." "empty archive en.bz2 over http"
63
64rm aptarchive/en.bz2
65
66rm aptarchive/Packages
67touch aptarchive/Packages
68buildaptarchivefromfiles
69
70testaptgetupdate "Ign http://localhost Release.gpg
71Ign http://localhost/ Translation-en
72Get:1 http://localhost Release []
73Ign http://localhost Packages/DiffIndex
74Get:2 http://localhost Packages []
75Reading package lists..." "empty archive Packages over http"
76
77find aptarchive/ -name 'Packages*' -type f -delete
78touch aptarchive/Packages.bz2
79aptftparchive release aptarchive/ > aptarchive/Release
80
81#FIXME: we should response with a good error message instead
82testaptgetupdate "Ign http://localhost Release.gpg
83Ign http://localhost/ Translation-en
84Get:1 http://localhost Release []
85Ign http://localhost Packages/DiffIndex
86Get:2 http://localhost Packages
87Err http://localhost Packages
88 Undetermined Error
89W: Failed to fetch http://localhost:8080/Packages.bz2 Undetermined Error
90
91E: Some index files failed to download, they have been ignored, or old ones used instead." "empty file Packages over http"