Bug#915671: symlinking /tmp to /run/tmp does not work
Serge Belyshev
belyshev at depni.sinp.msu.ru
Wed Dec 5 20:49:00 GMT 2018
Package: initscripts
Version: 2.93-1
In /usr/share/doc/initscripts/README.Debian it is documented that /tmp
could be a symlink to (for example) /run/tmp. This feature was
implemented in version 2.88dsf-13.3 (see
https://salsa.debian.org/debian/sysvinit/commit/3bec14850 ).
But currently it does not work, because bootclean.sh happens to run
before mountall.sh and chokes on a broken symlink.
Another issue is that mount_tmp() function creates the pointed-to
directory with the 755 mode, which is wrong for /tmp.
The following is a possible patch to fix these two problems (first
posted and discussed here:
http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/2018-December/000544.html ):
---
debian/src/initscripts/lib/init/bootclean.sh | 2 ++
debian/src/initscripts/lib/init/mount-functions.sh | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/debian/src/initscripts/lib/init/bootclean.sh b/debian/src/initscripts/lib/init/bootclean.sh
index 67e15a66..55f1c8b2 100644
--- a/debian/src/initscripts/lib/init/bootclean.sh
+++ b/debian/src/initscripts/lib/init/bootclean.sh
@@ -52,6 +52,8 @@ checkflagfile()
}
clean_tmp() {
+ # Will be created by mount_tmp()
+ [ -L /tmp ] && [ -d /tmp ] || return 0
# Does not exist
[ -d /tmp ] || return 1
# tmpfs does not require cleaning
diff --git a/debian/src/initscripts/lib/init/mount-functions.sh b/debian/src/initscripts/lib/init/mount-functions.sh
index e453f6a8..cd09883f 100644
--- a/debian/src/initscripts/lib/init/mount-functions.sh
+++ b/debian/src/initscripts/lib/init/mount-functions.sh
@@ -627,7 +627,7 @@ mount_tmp ()
# If /tmp is a symlink, make sure the linked-to directory exists.
if [ -L /tmp ] && [ ! -d /tmp ]; then
TMPPATH="$(readlink /tmp)"
- mkdir -p --mode=755 "$TMPPATH"
+ mkdir -p --mode="$TMP_MODE" "$TMPPATH"
[ -x /sbin/restorecon ] && /sbin/restorecon "$TMPPATH"
fi
More information about the Debian-init-diversity
mailing list