summaryrefslogtreecommitdiffstats
path: root/test/integration/test-bug-595691-empty-and-broken-archive-files
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 09:59:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 09:59:37 +0000
commit76e2632459410dec81337edb6a9fee33c9a660f3 (patch)
treea73345df208eede4a4daad340515c9328f34625c /test/integration/test-bug-595691-empty-and-broken-archive-files
parentInitial commit. (diff)
downloadapt-76e2632459410dec81337edb6a9fee33c9a660f3.tar.xz
apt-76e2632459410dec81337edb6a9fee33c9a660f3.zip
Adding upstream version 2.7.12.upstream/2.7.12
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/test-bug-595691-empty-and-broken-archive-files')
-rwxr-xr-xtest/integration/test-bug-595691-empty-and-broken-archive-files64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/integration/test-bug-595691-empty-and-broken-archive-files b/test/integration/test-bug-595691-empty-and-broken-archive-files
new file mode 100755
index 0000000..d71bd2c
--- /dev/null
+++ b/test/integration/test-bug-595691-empty-and-broken-archive-files
@@ -0,0 +1,64 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture "i386"
+
+buildaptarchive
+touch aptarchive/Packages
+setupflataptarchive
+
+failureupdate() {
+ rm -rf rootdir/var/lib/apt
+ testfailure aptget update --allow-insecure-repositories
+ testsuccess grep "^E: Failed to fetch store:${1} Empty files can't be valid archives$" rootdir/tmp/testfailure.output
+}
+successupdate() {
+ rm -rf rootdir/var/lib/apt
+ testwarning aptget update --allow-insecure-repositories
+}
+
+createemptyarchive() {
+ find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
+ touch aptarchive/Packages
+ echo -n "" | $COMPRESSOR_CMD > aptarchive/${1}.$COMPRESS
+ find aptarchive -name '*Release*' -delete
+ rm -f aptarchive/Packages
+}
+
+createemptyfile() {
+ find aptarchive/ \( -name "Packages*" -o -name "en*" \) -type f -delete
+ touch aptarchive/Packages aptarchive/${1}.$COMPRESS
+ find aptarchive -name '*Release*' -delete
+ rm -f aptarchive/Packages
+}
+
+testoverfile() {
+ local APTARCHIVE="$(readlink -f ./aptarchive)"
+ forcecompressor "$1"
+
+ msgmsg 'archive over file' "Packages.$COMPRESS"
+ createemptyarchive 'Packages'
+ successupdate
+ createemptyfile 'Packages'
+ failureupdate "$(readlink -f rootdir/var/lib/apt/lists/partial/$(echo "$APTARCHIVE" | sed -e 's#/#_#g')_Packages.${COMPRESS})"
+}
+
+testoverhttp() {
+ forcecompressor "$1"
+
+ msgmsg 'archive over http' "Packages.$COMPRESS"
+ createemptyarchive 'Packages'
+ successupdate
+ createemptyfile 'Packages'
+ failureupdate "$(readlink -f rootdir/var/lib/apt/lists/partial/localhost:${APTHTTPPORT}_Packages.${COMPRESS})"
+}
+
+forallsupportedcompressors testoverfile
+
+# do the same again with http instead of file
+changetowebserver
+
+forallsupportedcompressors testoverhttp