]>
git.saurik.com Git - apt.git/blob - test/integration/test-bug-595691-empty-and-broken-archive-files
b42212f5ea32f9f70c9457fbe7ce68c0a6e537bc
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#Get:[0-9]\+ #Get: #' -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 if [ "en" = "$1" ]; then
31 echo -n "" | $COMPRESSOR_CMD > aptarchive
/Packages.
$COMPRESS
33 touch aptarchive
/Packages
34 echo -n "" | $COMPRESSOR_CMD > aptarchive
/${1}.
$COMPRESS
37 rm -f aptarchive
/Packages
41 find aptarchive
/ \
( -name "Packages*" -o -name "en*" \
) -type f
-delete
42 if [ "en" = "$1" ]; then
43 echo -n "" | $COMPRESSOR_CMD > aptarchive
/Packages.
$COMPRESS
45 touch aptarchive
/Packages aptarchive
/${1}.
$COMPRESS
48 rm -f aptarchive
/Packages
52 local APTARCHIVE
="$(readlink -f ./aptarchive)"
56 testaptgetupdate
'Reading package lists...' "empty file en.$COMPRESS over file"
58 createemptyarchive
'en'
59 testaptgetupdate
'Reading package lists...' "empty archive en.$COMPRESS over file"
61 createemptyarchive
'Packages'
62 # FIXME: Why omits the file transport the Packages Get line?
63 #Get:3 file: Packages []
64 testaptgetupdate
'Reading package lists...' "empty archive Packages.$COMPRESS over file"
66 createemptyfile
'Packages'
67 testaptgetupdate
"Err file:$APTARCHIVE Packages
68 Empty files can't be valid archives
69 W: Failed to fetch ${COMPRESSOR}:${APTARCHIVE}/Packages.$COMPRESS Empty files can't be valid archives
71 E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over file"
77 createemptyarchive
'Packages'
78 testaptgetupdate
"Get: http://localhost:8080 Packages []
79 Reading package lists..." "empty archive Packages.$COMPRESS over http"
81 createemptyfile
'Packages'
82 #FIXME: we should response with a good error message instead
83 testaptgetupdate
"Get: http://localhost:8080 Packages
84 Err http://localhost:8080 Packages
85 Empty files can't be valid archives
86 W: Failed to fetch ${COMPRESSOR}:$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:8080_Packages.${COMPRESS}) Empty files can't be valid archives
88 E: Some index files failed to download. They have been ignored, or old ones used instead." "empty file Packages.$COMPRESS over http"
91 for COMPRESSOR
in 'gzip' 'bzip2' 'lzma' 'xz'; do testoverfile
$COMPRESSOR; done
93 # do the same again with http instead of file
96 for COMPRESSOR
in 'gzip' 'bzip2' 'lzma' 'xz'; do testoverhttp
$COMPRESSOR; done