From dc5bbb717374b33bc2c3dc4b9aabe5ee4bcc663b Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Sat, 11 Jan 2025 09:04:07 +0100 Subject: [PATCH] tests/chrootless: make sure that nothing outside the chroot changes --- tests/chrootless | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/chrootless b/tests/chrootless index 7a9d082..6dbb715 100644 --- a/tests/chrootless +++ b/tests/chrootless @@ -3,6 +3,7 @@ set -eu export LC_ALL=C.UTF-8 export SOURCE_DATE_EPOCH={{ SOURCE_DATE_EPOCH }} trap "rm -f /tmp/chrootless.tar /tmp/root.tar" EXIT INT TERM +before=$(tar --one-file-system --anchored --exclude="./var/log/journal/*" --exclude=./var/log/wtmp -C / -c ./usr ./bin ./etc ./lib ./sbin ./var | md5sum) for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do for MODE in root chrootless; do {{ CMD }} --mode=$MODE --variant={{ VARIANT }} \ @@ -12,3 +13,8 @@ for INCLUDE in '' 'apt' 'apt,build-essential' 'systemd-sysv'; do cmp /tmp/root.tar /tmp/chrootless.tar || diffoscope /tmp/root.tar /tmp/chrootless.tar rm /tmp/chrootless.tar /tmp/root.tar done +after=$(tar --one-file-system --anchored --exclude="./var/log/journal/*" --exclude=./var/log/wtmp -C / -c ./usr ./bin ./etc ./lib ./sbin ./var | md5sum) +if [ "$before" != "$after" ]; then + echo "found changes outside the chroot" >&2 + exit 1 +fi