Control: tags -1 patch

Bastian,

Thanks for this.

On Sun, Jan 05, 2025 at 01:00:15PM +0100, Bastian Blank wrote:
> Package: sysvinit-core
> Version: 3.11-1
> Severity: serious
> X-Debbugs-Cc: wa...@debian.org
> 
> Running the trigger of sysvinit-core unconditionally kills a pid 1 that
> is not sysvinit.  This process will not respond to the same signal
> protocol and just die.

This appears to be caused by the remaining parts of the /run/initctl migration
from 2013.

Dropping that and adding a condition that restart is only attempted if
/run/initctl exists seems a good solution to me.

Proposed patch attached. Do you have any comments on it?

Thanks

Mark
diff --git a/debian/changelog b/debian/changelog
index 2e8829d7..1855f4c5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,11 @@
+sysvinit (3.11-2) UNRELEASED; urgency=medium
+
+  * Drop remaining parts of /run/initctl migration: no longer HUP PID 1.
+    (Closes: #1092150)
+  * Remove $DPKG_ROOT from directory test: nonsensical after previous test.
+
+ -- Mark Hindley <lee...@debian.org>  Mon, 06 Jan 2025 09:53:04 +0000
+
 sysvinit (3.11-1) unstable; urgency=medium
 
   * New upstream version 3.11.
diff --git a/debian/sysvinit-core.postinst b/debian/sysvinit-core.postinst
index 23c28cd5..82e207c5 100755
--- a/debian/sysvinit-core.postinst
+++ b/debian/sysvinit-core.postinst
@@ -7,40 +7,7 @@ set -e
 
 # Restart init.
 do_restart() {
-	INITCTL=/run/initctl
-	case "$(uname -s)" in
-	  *FreeBSD)
-		OLDINITCTL=/etc/.initctl
-		;;
-	  *)
-		OLDINITCTL=/dev/initctl
-		;;
-	esac
-
-	# PID of init; may not always be 1 but this code isn't run in
-	# these cases (Hurd).  Use for sending signals and checking if
-	# init is running.
-	PID=1
-
-	# Create /run/initctl if not present, and also create compatibility
-	# symlinks
-	if [ ! -p "$INITCTL" ]
-	then
-		# Create new control channel
-		echo "sysvinit: creating $INITCTL"
-		rm -f $INITCTL
-		mkfifo -m 600 $INITCTL
-	fi
-
-	# Replace old control channel with symlink
-	ln -s "$INITCTL" "$OLDINITCTL.new"
-	mv "$OLDINITCTL.new" "$OLDINITCTL"
-
-	# Reopen control channel (uses new channel).
-	kill -s USR1 "$PID"
-
-	# Tell init to re-exec itself. Loop on failure to reduce the chance of a
-	# race before the new control channel is opened.
+	# Tell init to re-exec itself with loop on failure.
 	echo -n "sysvinit: restarting..."
 	for delay in 0 1 2 3 4 5 6 fail; do
 		if init u; then
@@ -86,7 +53,8 @@ esac
 
 if ischroot --default-true ||
 	[ -n "${DPKG_ROOT:-}" ] ||
-	[ -d "$DPKG_ROOT/run/systemd/system" ] ||
+	[ -d "/run/systemd/system" ] ||
+	[ ! -p "/run/initctl" ] ||
 	[ "$(uname -s)" = "GNU" ]; then
 	skip_restart=1
 fi

Reply via email to