Bug#669406: patch: remove overly aggressive optimization from /etc/init.d/rc

Dmitry Bogatov KAction at debian.org
Tue May 14 10:41:43 BST 2019


control: tags 669406 +patch +pending

From 59a9444af50c2b922db6b28cf7bb4476acaba19d Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <KAction at debian.org>
Date: Tue, 14 May 2019 08:07:02 +0000
Subject: [PATCH] Remove overly aggressive optimization from /etc/init.d/rc

The optimization:

	A start script is not run when the service was already
	configured to run in the previous runlevel.  A stop script is
	not run when the the service was already configured not to run
	in the previous runlevel.

assumes, that services are never started or stopped manually. It means,
that if service was started manually, but disabled in general, on
shutdown it will not be duly stoppend. This change remove such
optimization. (Closes: #669406)
---
 debian/src/sysv-rc/rc | 48 -------------------------------------------
 1 file changed, 48 deletions(-)

diff --git a/debian/src/sysv-rc/rc b/debian/src/sysv-rc/rc
index 025a1c54..3cf51dbb 100755
--- a/debian/src/sysv-rc/rc
+++ b/debian/src/sysv-rc/rc
@@ -4,11 +4,6 @@
 #
 # Starts/stops services on runlevel changes.
 #
-# Optimization: A start script is not run when the service was already
-# configured to run in the previous runlevel.  A stop script is not run
-# when the the service was already configured not to run in the previous
-# runlevel.
-#
 # Authors:
 # 	Miquel van Smoorenburg <miquels at cistron.nl>
 # 	Bruce Perens <Bruce at Pixar.com>
@@ -167,20 +162,6 @@ then
 				# Check if the script is there.
 				[ ! -f "$i" ] && continue
 
-				#
-				# Find stop script in previous runlevel but
-				# no start script there.
-				#
-				suffix=${i#/etc/rc$runlevel.d/K[0-9][0-9]}
-				previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix
-				previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
-				#
-				# If there is a stop script in the previous level
-				# and _no_ start script there, we don't
-				# have to re-stop the service.
-				#
-				[ -f $previous_stop ] && [ ! -f $previous_start ] && continue
-
 				# Stop the service.
 				SCRIPTS="$SCRIPTS $i"
 			done
@@ -214,35 +195,6 @@ then
 			do
 				[ ! -f "$i" ] && continue
 
-				suffix=${i#/etc/rc$runlevel.d/S[0-9][0-9]}
-				if [ "$previous" != N ]
-				then
-					#
-					# Find start script in previous runlevel and
-					# stop script in this runlevel.
-					#
-					stop=/etc/rc$runlevel.d/K[0-9][0-9]$suffix
-					previous_start=/etc/rc$previous.d/S[0-9][0-9]$suffix
-					#
-					# If there is a start script in the previous level
-					# and _no_ stop script in this level, we don't
-					# have to re-start the service.
-					#
-					if [ start = "$ACTION" ] ; then
-						[ -f $previous_start ] && [ ! -f $stop ] && continue
-					else
-						# Workaround for the special
-						# handling of runlevels 0 and 6.
-						previous_stop=/etc/rc$previous.d/K[0-9][0-9]$suffix
-						#
-						# If there is a stop script in the previous level
-						# and _no_ start script there, we don't
-						# have to re-stop the service.
-						#
-						[ -f $previous_stop ] && [ ! -f $previous_start ] && continue
-					fi
-
-				fi
 				SCRIPTS="$SCRIPTS $i"
 			done
 			startup $ACTION $SCRIPTS
-- 
        Note, that I send and fetch email in batch, once every 24 hours.
                 If matter is urgent, try https://t.me/kaction
                                                                             --
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://www.chiark.greenend.org.uk/pipermail/debian-init-diversity/attachments/20190514/21e8f4f3/attachment.sig>


More information about the Debian-init-diversity mailing list