summaryrefslogtreecommitdiff
path: root/test/integration/test-bug-818628-unreadable-source
blob: 84776dd8deb08e218b9d46f9434118defb3ace81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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