summaryrefslogtreecommitdiff
path: root/test/integration/framework
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-11-14 18:01:09 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-18 02:41:20 +0100
commit8fe964f148344b8a55252fe52b6292a4ab86ea98 (patch)
tree26c16373683528aec01f95dabe0bf6cbd356747e /test/integration/framework
parent1b671a9ba2e42e43f4cb1be86dc052823cf6961f (diff)
create our cache and lib directory always with mode 755
We autocreate for a while now the last two directories in /var/lib/apt/lists (similar for /var/cache/apt/archives) which is very nice for systems having any of those on tmpfs or other non-persistent storage. This also means though that this creation is effected by the default umask, so for people with aggressive umasks like 027 the directories will be created with 750, which means all non-root users are left out, which is usually exactly what we want then this umask is set, but the cache and lib directories contain public knowledge. There isn't any need to protect them from viewers and they render apt completely useless if not readable.
Diffstat (limited to 'test/integration/framework')
-rw-r--r--test/integration/framework24
1 files changed, 22 insertions, 2 deletions
diff --git a/test/integration/framework b/test/integration/framework
index c9f62c141..191e205ce 100644
--- a/test/integration/framework
+++ b/test/integration/framework
@@ -203,7 +203,7 @@ setupenvironment() {
mkdir rootdir aptarchive keys
cd rootdir
mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d
- mkdir -p usr/bin var/cache var/lib/apt var/log tmp
+ mkdir -p usr/bin var/cache var/lib var/log tmp
mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers
touch var/lib/dpkg/available
mkdir -p usr/lib/apt
@@ -1341,7 +1341,7 @@ testfilestats() {
msgpass
else
echo >&2
- ls -l >&2 "$1"
+ ls -ld >&2 "$1"
echo -n >&2 "stat(1) reports for $2: "
stat --format "$2" "$1"
msgfail
@@ -1386,6 +1386,24 @@ listcurrentlistsdirectory() {
done
}
+### convinience hacks ###
+mkdir() {
+ # creating some directories by hand is a tedious task, so make it look simple
+ if [ "$*" = '-p rootdir/var/lib/apt/lists' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" ] ||
+ [ "$*" = '-p rootdir/var/lib/apt/lists/partial' ] || [ "$*" = "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" ]; then
+ # only the last directory created by mkdir is effected by the -m !
+ command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt"
+ command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"
+ command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
+ touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock"
+ if [ "$(id -u)" = '0' ]; then
+ chown _apt:root "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial"
+ fi
+ else
+ command mkdir "$@"
+ fi
+}
+
### The following tests are run by most test methods automatically to check
### general things about commands executed without writing the test every time.
@@ -1410,6 +1428,8 @@ aptautotest() {
aptautotest_aptget_update() {
if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi
+ testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${USER}:${USER}:755"
+ testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${USER}:${USER}:755"
# all copied files are properly chmodded
for file in $(find "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -maxdepth 1 -type f ! -name 'lock'); do
testfilestats "$file" '%U:%G:%a' '=' "${USER}:${USER}:644"