From 7123808b6cf7e25ea30ec970fe02fd5555ee1ffb Mon Sep 17 00:00:00 2001 From: Johannes Schauer Marin Rodrigues Date: Tue, 6 Sep 2022 16:58:20 +0200 Subject: [PATCH] =?UTF-8?q?do=20not=20clean=20up=20/run/lock=20as=20/var/l?= =?UTF-8?q?ock=20is=20a=20symlink=20to=20it=20according=20to=20Debian=20po?= =?UTF-8?q?licy=20=C2=A79.1.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mmdebstrap | 3 +++ tests/as-debootstrap-unshare-wrapper | 4 ++-- tests/check-against-debootstrap-dist | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mmdebstrap b/mmdebstrap index 65a4490..50666f4 100755 --- a/mmdebstrap +++ b/mmdebstrap @@ -3022,6 +3022,9 @@ sub run_cleanup() { # skip the "." and ".." entries next if $entry eq "."; next if $entry eq ".."; + # skip deleting /run/lock as /var/lock is a symlink to it + # according to Debian policy ยง9.1.4 + next if $entry eq "lock"; debug "deleting files in /run: $entry"; 0 == system( 'rm', '--interactive=never', diff --git a/tests/as-debootstrap-unshare-wrapper b/tests/as-debootstrap-unshare-wrapper index 43e2fa0..80a511f 100644 --- a/tests/as-debootstrap-unshare-wrapper +++ b/tests/as-debootstrap-unshare-wrapper @@ -34,8 +34,8 @@ rm /tmp/debian-debootstrap/var/log/dpkg.log \ /tmp/debian-debootstrap/var/log/alternatives.log \ /tmp/debian-mm/var/log/bootstrap.log -# clear out /run -rm -r /tmp/debian-debootstrap/run/* +# clear out /run except for /run/lock +find /tmp/debian-debootstrap/run/ -mindepth 1 -maxdepth 1 ! -name lock -print0 | xargs --no-run-if-empty -0 rm -r # debootstrap doesn't clean apt rm /tmp/debian-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_unstable_main_binary-{{ HOSTARCH }}_Packages \ diff --git a/tests/check-against-debootstrap-dist b/tests/check-against-debootstrap-dist index a386a8a..8a8e0e9 100644 --- a/tests/check-against-debootstrap-dist +++ b/tests/check-against-debootstrap-dist @@ -95,8 +95,8 @@ fi if [ -e /tmp/debian-{{ DIST }}-mm/etc/apt/apt.conf.d/01autoremove-kernels ]; then rm /tmp/debian-{{ DIST }}-mm/etc/apt/apt.conf.d/01autoremove-kernels fi -# clear out /run -rm -r /tmp/debian-{{ DIST }}-debootstrap/run/* +# clear out /run except for /run/lock +find /tmp/debian-{{ DIST }}-debootstrap/run/ -mindepth 1 -maxdepth 1 ! -name lock -print0 | xargs --no-run-if-empty -0 rm -r # debootstrap doesn't clean apt rm /tmp/debian-{{ DIST }}-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_{{ DIST }}_main_binary-{{ HOSTARCH }}_Packages \ /tmp/debian-{{ DIST }}-debootstrap/var/lib/apt/lists/127.0.0.1_debian_dists_{{ DIST }}_Release \