]>
git.saurik.com Git - apt.git/blob - test/integration/test-bug-595691-empty-and-broken-archive-files
57e3c3dcf93b84c4170c70254987ff2aab5d205d
4 TESTDIR
=$(readlink -f $(dirname $0))
7 configarchitecture
"i386"
10 touch aptarchive
/Packages
14 rm -rf rootdir
/var
/lib
/apt
15 aptget update
>testaptgetupdate.
diff 2>&1 || true
16 sed -i -e '/Ign /,+1d' -e '/Release/ d' -e 's#\[[0-9]* [kMGTPY]*B\]#\[\]#' testaptgetupdate.
diff
19 msgtest
"Test for correctness of" "apt-get update with $*"
20 if [ -z "$GIVEN" ]; then
21 echo -n "" | checkdiff
- testaptgetupdate.
diff && msgpass
|| msgfail
23 echo "$GIVEN" | checkdiff
- testaptgetupdate.
diff && msgpass
|| msgfail
25 rm testaptgetupdate.
diff
28 createemptyarchive
() {
29 find aptarchive
/ \
( -name "Packages*" -o -name "en*" \
) -type f
-delete
30 touch aptarchive
/Packages
31 echo -n "" | $COMPRESSOR_CMD > aptarchive
/${1}.
$COMPRESS
34 rm -f aptarchive
/Packages
38 find aptarchive
/ \
( -name "Packages*" -o -name "en*" \
) -type f
-delete
39 touch aptarchive
/Packages aptarchive
/${1}.
$COMPRESS
42 rm -f aptarchive
/Packages
46 local APTARCHIVE
="$(readlink -f ./aptarchive)"
49 createemptyarchive
'Packages'
50 testaptgetupdate
"Get:2 file:$APTARCHIVE Packages []
51 Reading package lists..." "empty archive Packages.$COMPRESS over file"
53 createemptyfile
'Packages'
54 testaptgetupdate
"Get:2 file:$APTARCHIVE Packages
55 Err:2 file:$APTARCHIVE Packages
56 Empty files can't be valid archives
57 Reading package lists...
58 W: Failed to fetch ${COMPRESSOR}:${APTARCHIVE}/Packages.$COMPRESS Empty files can't be valid archives
59 E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over file"
65 createemptyarchive
'Packages'
66 testaptgetupdate
"Get:2 http://localhost:${APTHTTPPORT} Packages []
67 Reading package lists..." "empty archive Packages.$COMPRESS over http"
69 createemptyfile
'Packages'
70 #FIXME: we should response with a good error message instead
71 testaptgetupdate
"Get:2 http://localhost:${APTHTTPPORT} Packages
72 Err:2 http://localhost:${APTHTTPPORT} Packages
73 Empty files can't be valid archives
74 Reading package lists...
75 W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:${APTHTTPPORT}_Packages.${COMPRESS}) Empty files can't be valid archives
76 E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over http"
79 for COMPRESSOR
in 'gzip' 'bzip2' 'lzma' 'xz'; do testoverfile
$COMPRESSOR; done
81 # do the same again with http instead of file
84 for COMPRESSOR
in 'gzip' 'bzip2' 'lzma' 'xz'; do testoverhttp
$COMPRESSOR; done