]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-file
new quiet level -qq for apt to hide progress output
[apt.git] / test / integration / test-apt-update-file
CommitLineData
daff4aa3
MV
1#!/bin/sh
2#
3# Ensure that we do not modify file:/// uris (regression test for
4# CVE-2014-0487
5#
6set -e
7
8TESTDIR=$(readlink -f $(dirname $0))
9. $TESTDIR/framework
10
11setupenvironment
12configarchitecture "amd64"
846bc058 13configcompression 'bz2' 'gz'
c5ede4ca 14confighashes 'SHA512'
daff4aa3 15
846bc058
DK
16insertpackage 'unstable' 'foo' 'all' '1'
17insertsource 'unstable' 'foo' 'all' '1'
daff4aa3 18
daff4aa3
MV
19setupaptarchive --no-update
20
21# ensure the archive is not writable
846bc058 22addtrap 'prefix' 'chmod 750 aptarchive/dists/unstable/main/binary-amd64;'
daff4aa3
MV
23chmod 550 aptarchive/dists/unstable/main/binary-amd64
24
846bc058 25testsuccess aptget update
448c38bd
DK
26
27# the release files aren't an IMS-hit, but the indexes are
28redatereleasefiles '+1 hour'
29
8d041b4f 30# we don't download the index if it isn't updated
846bc058 31testsuccess aptget update -o Debug::pkgAcquire::Auth=1
8d041b4f 32# file:/ isn't shown in the log, so see if it was downloaded anyhow
846bc058 33cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output
8d041b4f
DK
34canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')"
35testfailure grep -- "$canary" rootdir/tmp/update.output
36
37testfoo() {
38 # foo is still available
39 testsuccess aptget install -s foo
40 testsuccess aptcache showsrc foo
41 testsuccess aptget source foo --print-uris
42}
43testfoo
44
45# the release file is new again, the index still isn't, but it is somehow gone now from disk
46redatereleasefiles '+2 hour'
47find rootdir/var/lib/apt/lists -name '*_Packages*' -delete
23d0a6fb 48
8d041b4f
DK
49testsuccess aptget update -o Debug::pkgAcquire::Auth=1
50# file:/ isn't shown in the log, so see if it was downloaded anyhow
51cp -a rootdir/tmp/testsuccess.output rootdir/tmp/update.output
23d0a6fb 52canary="SHA512:$(bzcat aptarchive/dists/unstable/main/binary-amd64/Packages.bz2 | sha512sum |cut -f1 -d' ')"
846bc058 53testsuccess grep -- "$canary" rootdir/tmp/update.output
23d0a6fb 54
8d041b4f 55testfoo