diff options
author | Julian Andres Klode <jak@debian.org> | 2016-03-19 01:56:38 +0100 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2016-03-19 07:19:24 +0100 |
commit | f40fdaa43271edf98b80c08e20f401b5da591501 (patch) | |
tree | 11fc9ad9daaf7ba0223688fcff90a5332e1916b6 /test/integration | |
parent | 03bcd80f2680f0f52902665f4efe7ac83fd2aef0 (diff) |
cachefile: Only set members that were initialized successfully
Otherwise, things will just start failing later down the stack,
because (a) the lazy getters do not check if building was successful
and (b) any further getter call would return the invalid object
anyway.
Also initialize VS in pkgCache to nullptr by default.
Closes: #818628
Diffstat (limited to 'test/integration')
-rwxr-xr-x | test/integration/test-bug-818628-unreadable-source | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/test/integration/test-bug-818628-unreadable-source b/test/integration/test-bug-818628-unreadable-source new file mode 100755 index 000000000..84776dd8d --- /dev/null +++ b/test/integration/test-bug-818628-unreadable-source @@ -0,0 +1,42 @@ +#!/bin/sh +set -e + +TESTDIR="$(readlink -f "$(dirname "$0")")" +. "$TESTDIR/framework" +setupenvironment +configarchitecture 'amd64' 'i386' + +if [ "$(id -u)" = "0" ]; then + msgskip "Tests for unreadable sources.list do not work as root" + exit 0 +fi + +insertinstalledpackage 'apt' 'i386' '1' +buildsimplenativepackage 'apt' 'i386' '2' 'unstable' + +setupaptarchive + +# Test unreadable sources.list files +chmod -r rootdir/etc/apt/sources.list.d + +testfailureequal "E: Unable to read $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/ - opendir (13: Permission denied) +W: You may want to run apt-get update to correct these problems +E: The package cache file is corrupted" aptcache policy apt +testfailureequal "E: Unable to read $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/ - opendir (13: Permission denied) +W: You may want to run apt-get update to correct these problems +E: The package cache file is corrupted" apt search apt + +chmod +r rootdir/etc/apt/sources.list.d + + +# Test unreadable sources.list files +chmod -r rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list + +testfailureequal "E: Opening $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list - ifstream::ifstream (13: Permission denied) +E: The list of sources could not be read. +E: Opening $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list - ifstream::ifstream (13: Permission denied) +E: The list of sources could not be read." aptcache policy apt +testfailureequal "E: Opening $TMPWORKINGDIRECTORY/rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list - ifstream::ifstream (13: Permission denied) +E: The list of sources could not be read." apt search apt + +chmod +r rootdir/etc/apt/sources.list.d/apt-test-unstable-deb-src.list |