Bug#693398: broken cleanup handling in *-bootclean

Mark Hindley mark at hindley.org.uk
Mon Oct 27 18:55:59 GMT 2025


Control: tags -1 patch

Michael,

Thanks and apologies for the extreme delay here.

Whilst this doesn't seem to cause any issues, I agree that it is less efficient
than it could be.

Samuel,

On the only GNU hurd system I have access to (exodar is refusing connections
today), /run is also a tmpfs. Is that now obligatory on Hurd as well? Do you see
any problems for Hurd here?

Below is a first attempt at a patch.

Any comments?

Thanks

Mark

diff --git a/debian/changelog b/debian/changelog
index f52de029..f23c0c43 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+sysvinit (3.15-6~rc1) UNRELEASED; urgency=medium
+
+  * Drop mountnfs-bootclean.sh.
+  * mountall-bootclean.sh: only clean /tmp.
+  * checkroot-bootclean.sh: only clean /tmp.
+  * bootclean.sh: remove obsolete functions clean() and clean_all().
+
+ -- Mark Hindley <leepen at debian.org>  Mon, 27 Oct 2025 18:09:17 +0000
+
 sysvinit (3.15-5) unstable; urgency=medium
 
   * Release to unstable
diff --git a/debian/initscripts.maintscript b/debian/initscripts.maintscript
index 67968801..34849cbf 100644
--- a/debian/initscripts.maintscript
+++ b/debian/initscripts.maintscript
@@ -1 +1,2 @@
 rm_conffile /etc/init.d/motd 2.93-3~ initscripts
+rm_conffile /etc/init.d/mountnfs-bootclean.sh 3.15-6~ initscripts
diff --git a/debian/initscripts.postinst b/debian/initscripts.postinst
index 781a660b..701bdaf7 100755
--- a/debian/initscripts.postinst
+++ b/debian/initscripts.postinst
@@ -40,7 +40,7 @@ umask 022
 
 INITSCRIPTS="mountkernfs.sh mount-configfs brightness hostname.sh mountdevsubfs.sh checkroot.sh \
 	checkroot-bootclean.sh checkfs.sh mountall.sh mountall-bootclean.sh \
-	mountnfs.sh mountnfs-bootclean.sh bootmisc.sh urandom halt reboot \
+	mountnfs.sh bootmisc.sh urandom halt reboot \
 	udev umountroot umountfs umountnfs.sh sendsigs killprocs single motd \
 	bootlogs rc.local rmnologin hwclock.sh kmod"
 
diff --git a/debian/initscripts.postrm b/debian/initscripts.postrm
index 25bbb932..d27e9cbd 100755
--- a/debian/initscripts.postrm
+++ b/debian/initscripts.postrm
@@ -7,7 +7,7 @@ set -e
 
 INITSCRIPTS="mountkernfs.sh mount-configfs brightness hostname.sh mountdevsubfs.sh checkroot.sh \
 	checkroot-bootclean.sh checkfs.sh mountall.sh mountall-bootclean.sh \
-	mountnfs.sh mountnfs-bootclean.sh bootmisc.sh urandom halt reboot \
+	mountnfs.sh bootmisc.sh urandom halt reboot \
 	udev umountroot umountfs umountnfs.sh sendsigs killprocs single motd \
 	bootlogs rc.local rmnologin hwclock.sh"
 
diff --git a/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh b/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh
index fef8dbce..d847ee2e 100755
--- a/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh
+++ b/debian/src/initscripts/etc/init.d/checkroot-bootclean.sh
@@ -17,14 +17,14 @@
 
 case "$1" in
 	start | "")
-		# Clean /tmp, /run and /run/lock.  Remove the .clean files to
+		# Clean /tmp.  Remove the .clean files to
 		# force initial cleaning.  This is intended to allow cleaning
 		# of directories masked by mounts while the system was
 		# previously running, which would otherwise prevent them being
 		# cleaned.
 		rm -f /tmp/.clean /run/.clean /run/lock/.clean
 
-		clean_all
+		clean_tmp
 		exit $?
 		;;
 	restart | reload | force-reload)
diff --git a/debian/src/initscripts/etc/init.d/mountall-bootclean.sh b/debian/src/initscripts/etc/init.d/mountall-bootclean.sh
index dd8676b7..68f9c41b 100755
--- a/debian/src/initscripts/etc/init.d/mountall-bootclean.sh
+++ b/debian/src/initscripts/etc/init.d/mountall-bootclean.sh
@@ -15,8 +15,8 @@
 
 case "$1" in
 	start | "")
-		# Clean /tmp, /var/lock, /var/run
-		clean_all
+		# Clean /tmp
+		clean_tmp
 		exit $?
 		;;
 	restart | reload | force-reload)
diff --git a/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh b/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh
deleted file mode 100755
index 6345d51a..00000000
--- a/debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh
+++ /dev/null
@@ -1,35 +0,0 @@
-#! /bin/sh
-### BEGIN INIT INFO
-# Provides:          mountnfs-bootclean
-# Required-Start:    $local_fs mountnfs
-# Required-Stop:
-# Default-Start:     S
-# Default-Stop:
-# X-Start-Before:    bootmisc
-# Short-Description: bootclean after mountnfs.
-# Description:       Clean temporary filesystems after
-#                    network filesystems have been mounted.
-### END INIT INFO
-
-. /lib/init/bootclean.sh
-
-case "$1" in
-	start | "")
-		# Clean /tmp, /var/lock, /var/run
-		clean_all
-		exit $?
-		;;
-	restart | reload | force-reload)
-		echo "Error: argument '$1' not supported" >&2
-		exit 3
-		;;
-	stop | status)
-		# No-op
-		;;
-	*)
-		echo "Usage: mountnfs-bootclean.sh [start|stop]" >&2
-		exit 3
-		;;
-esac
-
-:
diff --git a/debian/src/initscripts/lib/init/bootclean.sh b/debian/src/initscripts/lib/init/bootclean.sh
index 9951201f..3fc6a340 100644
--- a/debian/src/initscripts/lib/init/bootclean.sh
+++ b/debian/src/initscripts/lib/init/bootclean.sh
@@ -160,50 +160,3 @@ clean_tmp() {
 	log_progress_msg "/tmp"
 	return 0
 }
-
-clean() {
-	dir="$1"
-	findopts="$2"
-
-	# Does not exist
-	[ -d "$dir" ] || return 1
-	# Read-only filesystem?
-	[ -w "$dir" ] || return 0
-	# tmpfs does not require cleaning
-	[ -f "$dir/.tmpfs" ] && return 0
-	# Can clean?
-	checkflagfile "$dir" || return 0
-	# Already cleaned
-	[ -f "${dir}/.clean" ] && return 0
-	# Can't clean yet?
-	which find >/dev/null 2>&1 || return 1
-
-	cd "$dir" || {
-		log_action_end_msg 1 "bootclean: Could not cd to ${dir}."
-		return 1
-	}
-
-	[ "$VERBOSE" = no ] || log_action_begin_msg "Cleaning $dir"
-
-	find . $findopts -delete ||
-		{
-			report_err "$dir"
-			return 1
-		}
-	[ "$VERBOSE" = no ] || log_action_end_msg 0
-	mkflagfile "${dir}/.clean" || return 1
-	log_progress_msg "$dir"
-	return 0
-}
-
-clean_all() {
-	which find >/dev/null 2>&1 || return 0
-	log_begin_msg "Cleaning up temporary files..."
-	ES=0
-	clean_tmp || ES=1
-	clean /run "( -path /run/network/mountnfs -o ! -xtype d ! -name utmp ! -name innd.pid )" || ES=1
-	clean /run/lock "! -type d" || ES=1
-	clean /run/shm "! -type d" || ES=1
-	log_end_msg $ES
-	return $ES
-}



More information about the Debian-init-diversity mailing list