Bug#719249: Patch
Mark Hindley
mark at hindley.org.uk
Tue Sep 30 16:53:15 BST 2025
Control: tags -1 patch
Matthijs,
Firstly apologies for the extreme delay here.
I think this patch does the right thing.
Any comments?
Mark
commit f20e36e2ae1acb17aa30e5d948c6cb5a34c182be
Author: Mark Hindley <mark at hindley.org.uk>
Date: Tue Sep 30 16:46:46 2025 +0100
Only create .tmpfs if mount has been successful.
Closes: #719249
diff --git a/debian/src/initscripts/lib/init/mount-functions.sh b/debian/src/initscripts/lib/init/mount-functions.sh
index 8e9a80e4..98baf4e2 100644
--- a/debian/src/initscripts/lib/init/mount-functions.sh
+++ b/debian/src/initscripts/lib/init/mount-functions.sh
@@ -265,6 +265,7 @@ domount() {
MOUNTMODE=remount
fi
+ status=
case "$MOUNTMODE" in
mount)
if mountpoint -q "$MTPT"; then
@@ -277,6 +278,7 @@ domount() {
is_empty_dir "$MTPT" >/dev/null 2>&1 || log_warning_msg "Files under mount point '$MTPT' will be hidden."
fi
mount $MOUNTFLAGS -t $FSTYPE $CALLER_OPTS $FSTAB_OPTS $FS_OPTS $DEVNAME $MTPT
+ status=$?
if [ "$FSTYPE" = "tmpfs" ] && [ -x /sbin/restorecon ]; then
/sbin/restorecon $MTPT
fi
@@ -286,9 +288,14 @@ domount() {
if mountpoint -q "$MTPT"; then
# Remount with user-specified mount options
mount $MOUNTFLAGS -oremount $CALLER_OPTS $FSTAB_OPTS $MTPT
+ status=$?
fi
;;
esac
+ if [ "$FSTYPE" = "tmpfs" ] && [ "$status" -eq 0 ]; then
+ # Make sure we don't get cleaned
+ touch "$MTPT/.tmpfs"
+ fi
}
#
@@ -515,9 +522,6 @@ mount_run() {
# Make pidfile omit directory for sendsigs
[ -d /run/sendsigs.omit.d ] || mkdir --mode=755 /run/sendsigs.omit.d/
-
- # Make sure we don't get cleaned
- touch /run/.tmpfs
}
# Mount /run/lock
@@ -558,8 +562,6 @@ mount_lock() {
# additional tmpfs.
if [ yes = "$RAMLOCK" ]; then
domount "$MNTMODE" tmpfs shmfs /run/lock tmpfs "-o${NODEV}noexec,nosuid$LOCK_OPT"
- # Make sure we don't get cleaned
- touch /run/lock/.tmpfs
else
chmod "$LOCK_MODE" /run/lock
fi
@@ -614,8 +616,6 @@ mount_shm() {
if [ yes = "$RAMSHM" ]; then
domount "$MNTMODE" tmpfs shmfs "$SHMDIR" tmpfs "-onosuid,${NODEV}noexec$SHM_OPT"
- # Make sure we don't get cleaned
- touch "$SHMDIR"/.tmpfs
else
chmod "$SHM_MODE" "$SHMDIR"
fi
@@ -695,8 +695,6 @@ mount_tmp() {
# Mount /tmp as tmpfs if enabled.
if [ yes = "$RAMTMP" ]; then
domount "$MNTMODE" tmpfs shmfs /tmp tmpfs "-o${NODEV}nosuid$TMP_OPT"
- # Make sure we don't get cleaned
- touch /tmp/.tmpfs
else
# When root is still read only, this will fail.
if [ mount_noupdate != "$MNTMODE" ] && [ rw = "$rootmode" ]; then
More information about the Debian-init-diversity
mailing list