From 37678c4fb53b181b16186fc753490000c43c1f2c Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Mon, 24 Jun 2024 19:17:19 +0200 Subject: [PATCH] tests/check-against-debootstrap-dist: allow /var/log/{faillog,lastlog} to be absent --- tests/check-against-debootstrap-dist | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/check-against-debootstrap-dist b/tests/check-against-debootstrap-dist index 3ac0db3..ee4de26 100644 --- a/tests/check-against-debootstrap-dist +++ b/tests/check-against-debootstrap-dist @@ -157,12 +157,18 @@ if [ "{{ VARIANT }}" = "-" ] && [ "{{ DIST}}" = oldstable ]; then fi for log in faillog lastlog; do - if ! cmp /tmp/debian-{{ DIST }}-debootstrap/var/log/$log /tmp/debian-{{ DIST }}-mm/var/log/$log >&2;then + f1="/tmp/debian-{{ DIST }}-debootstrap/var/log/$log" + f2="/tmp/debian-{{ DIST }}-mm/var/log/$log" + # skip cmp if file is absent in both chroots + if [ ! -e "$f1" ] && [ ! -e "$f2" ]; then + continue + fi + if ! cmp "$f1" "$f2" >&2;then # if the files differ, make sure they are all zeroes - cmp -n "$(stat -c %s "/tmp/debian-{{ DIST }}-debootstrap/var/log/$log")" "/tmp/debian-{{ DIST }}-debootstrap/var/log/$log" /dev/zero >&2 - cmp -n "$(stat -c %s "/tmp/debian-{{ DIST }}-mm/var/log/$log")" "/tmp/debian-{{ DIST }}-mm/var/log/$log" /dev/zero >&2 + cmp -n "$(stat -c %s "$f1")" "$f1" /dev/zero >&2 + cmp -n "$(stat -c %s "$f2")" "$f2" /dev/zero >&2 # then delete them - rm /tmp/debian-{{ DIST }}-debootstrap/var/log/$log /tmp/debian-{{ DIST }}-mm/var/log/$log + rm "$f1" "$f2" fi done