From 07e3673161f46496a6d0a0a1c9462177008ec85a Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Tue, 18 Oct 2022 10:20:02 +0200 Subject: [PATCH] tests/as-debootstrap-unshare-wrapper: systemd-sysusers before systemd 252 doesn't respect SOURCE_DATE_EPOCH when adding users to /etc/shadow --- tests/as-debootstrap-unshare-wrapper | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/as-debootstrap-unshare-wrapper b/tests/as-debootstrap-unshare-wrapper index eb251b9..800d562 100644 --- a/tests/as-debootstrap-unshare-wrapper +++ b/tests/as-debootstrap-unshare-wrapper @@ -47,6 +47,20 @@ rm /tmp/debian-mm/var/cache/apt/archives/lock rm /tmp/debian-mm/var/lib/apt/lists/lock rm /tmp/debian-mm/var/lib/dpkg/arch +# workaround for https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=917773 +# also needed for users that are created by systemd-sysusers before systemd 252 +# https://github.com/systemd/systemd/pull/24534 +for f in shadow shadow-; do + if ! cmp /tmp/debian-debootstrap/etc/$f /tmp/debian-mm/etc/$f >&2; then + echo patching /etc/$f >&2 + awk -v FS=: -v OFS=: -v SDE={{ SOURCE_DATE_EPOCH }} '{ print $1,$2,int(SDE/60/60/24),$4,$5,$6,$7,$8,$9 }' < /tmp/debian-mm/etc/$f > /tmp/debian-mm/etc/$f.bak + cat /tmp/debian-mm/etc/$f.bak > /tmp/debian-mm/etc/$f + rm /tmp/debian-mm/etc/$f.bak + else + echo no difference for /etc/$f >&2 + fi +done + # check if the file content differs diff --no-dereference --recursive /tmp/debian-debootstrap /tmp/debian-mm >&2