diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-09 18:11:02 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2021-04-13 16:00:41 +0200 |
commit | 27a4fb3a9ac67a13ed516c75feefdc1fd426520a (patch) | |
tree | bfa07ca3f6792dbac9be0b8c329984e63ccab1a5 /test | |
parent | aa6cbf09c24ae135ea3547c94869f28f8dec2b5a (diff) |
Fix downloads of unsized files that are largest in pipeline
The maximum request size is accidentally set to any sized file,
so if an unsized file is present, and it turns out to be larger
than the maximum size we set, we'd error out when checking if
its size is smaller than the maximum request size.
LP: #1921626
Diffstat (limited to 'test')
-rwxr-xr-x | test/integration/test-ubuntu-bug-1921626-unsized-packages | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/test/integration/test-ubuntu-bug-1921626-unsized-packages b/test/integration/test-ubuntu-bug-1921626-unsized-packages new file mode 100755 index 000000000..5442124aa --- /dev/null +++ b/test/integration/test-ubuntu-bug-1921626-unsized-packages @@ -0,0 +1,38 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" + +setupenvironment +configarchitecture "i386" +confighashes 'SHA512' + +mkdir tree +head -c $((5*1024)) /dev/urandom > tree/data-file + +buildsimplenativepackage 'a' 'all' '1.0' 'stable' +buildsimplenativepackage 'b' 'all' '1.0' 'stable' '' '' '' '' "$PWD/tree" +buildsimplenativepackage 'c' 'all' '1.0' 'stable' + +setupaptarchive +changetowebserver + +# Disable sandbox +echo 'APT::Sandbox::User "root";' > rootdir/etc/apt/apt.conf.d/no-acquire-sandbox + +testsuccess apt update + +for file in rootdir/var/lib/apt/lists/*Packages; do + awk '!(/^Size/ && ++cnt==2)' $file > $file.new + mv $file.new $file +done + + +size_a=$(wc -c aptarchive/pool/a_1.0_all.deb | awk '{print $1}') +size_b=$(wc -c aptarchive/pool/b_1.0_all.deb | awk '{print $1}') +size_c=$(wc -c aptarchive/pool/c_1.0_all.deb | awk '{print $1}') + +testsuccessequal "Get:1 http://localhost:${APTHTTPPORT} stable/main all a all 1.0 [$size_a B] +Get:2 http://localhost:${APTHTTPPORT} stable/main all b all 1.0 [$size_b B] +Get:3 http://localhost:${APTHTTPPORT} stable/main all c all 1.0 [$size_c B]" apt download a b c -o Acquire::AllowUnsizedPackages=true |