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