[Pkg-sysvinit-devel] Bug#738759: fix for the bug

2014-04-21 Thread Petter Reinholdtsen
[Gerfried Fuchs]
   Hi!

 Please find attach a proposed patch for the issue.  I hope we can get
 around at work to test it properly within the next few days, but from
 what I can tell this should be a good approach.

The legacy boot ordering is going away, and startpar is the future way
to start init.d scripts.  Why should we spend time updating the legacy
boot ordering?

Why are you not using the default boot startup system?  If you did, the
code in question would not be used at all.  How did you discover this
problem in the first place?

-- 
Happy hacking
Petter Reinholdtsen

___
Pkg-sysvinit-devel mailing list
Pkg-sysvinit-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-sysvinit-devel


[Pkg-sysvinit-devel] Bug#738759: fix for the bug

2014-02-16 Thread Gerfried Fuchs
* Gerfried Fuchs rho...@deb.at [2014-02-14 08:08:14 CET]:
  Please find attach a proposed patch for the issue.  I hope we can get
 around at work to test it properly within the next few days, but from
 what I can tell this should be a good approach.

 And a patch on top of that.  I had the false impression that return is
able to return a string too, but that's not possible with in shell.
Thus the new patch with edit the varible directly inside the function,
which I actually tried to avoid, but that's not really possible within
shell scripts it seems.

 Enjoy,
Rhonda
-- 
Fühlst du dich mutlos, fass endlich Mut, los  |
Fühlst du dich hilflos, geh raus und hilf, los| Wir sind Helden
Fühlst du dich machtlos, geh raus und mach, los   | 23.55: Alles auf Anfang
Fühlst du dich haltlos, such Halt und lass los|
From 668707eadf4cb546f782917d57eb7c7c024f51ca Mon Sep 17 00:00:00 2001
From: Gerfried Fuchs rho...@debian.org
Date: Sun, 16 Feb 2014 10:54:52 +0100
Subject: [PATCH 2/2] return in shell scripts only work with numeric values

This fixes the error in the first patch.  I would have liked it to not
have to edit the variable within the functions for easier reading, but
unfortunately shell doesn't offer that possibility.
---
 debian/src/sysv-rc/etc/init.d/rc | 22 +++---
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/debian/src/sysv-rc/etc/init.d/rc b/debian/src/sysv-rc/etc/init.d/rc
index 7767778..9d8024f 100644
--- a/debian/src/sysv-rc/etc/init.d/rc
+++ b/debian/src/sysv-rc/etc/init.d/rc
@@ -128,7 +128,7 @@ esac
 kill_test_add() {
 	script=$1
 	# Check if the script is there.
-	[ ! -f $script ]  return 
+	[ ! -f $script ]  return
 
 	#
 	# Find stop script in previous runlevel but
@@ -142,14 +142,14 @@ kill_test_add() {
 	# and _no_ start script there, we don't
 	# have to re-stop the service.
 	#
-	[ -f $previous_stop ]  [ ! -f $previous_start ]  return 
+	[ -f $previous_stop ]  [ ! -f $previous_start ]  return
 
 	# Stop the service.
-	return $script
+	SCRIPTS=$SCRIPTS $script
 }
 start_test_add() {
 	script=$1
-	[ ! -f $script ]  return 
+	[ ! -f $script ]  return
 
 	suffix=${script#/etc/rc$runlevel.d/S[0-9][0-9]}
 	if [ $previous != N ]
@@ -166,7 +166,7 @@ start_test_add() {
 		# have to re-start the service.
 		#
 		if [ start = $ACTION ] ; then
-			[ -f $previous_start ]  [ ! -f $stop ]  return 
+			[ -f $previous_start ]  [ ! -f $stop ]  return
 		else
 			# Workaround for the special
 			# handling of runlevels 0 and 6.
@@ -176,11 +176,11 @@ start_test_add() {
 			# and _no_ start script there, we don't
 			# have to re-stop the service.
 			#
-			[ -f $previous_stop ]  [ ! -f $previous_start ]  return 
+			[ -f $previous_stop ]  [ ! -f $previous_start ]  return
 		fi
 
 	fi
-	return $script
+	SCRIPTS=$SCRIPTS $script
 }
 
 # Is there an rc directory for this new runlevel?
@@ -221,10 +221,10 @@ then
 			fi
 			if [ $level = $CURLEVEL ]
 			then
-SCRIPTS=$SCRIPTS $(kill_test_add $s)
+kill_test_add $s
 continue
 			fi
-			SCRIPTS=$SCRIPTS $(kill_test_add $s)
+			kill_test_add $s
 
 			startup stop $SCRIPTS
 			CURLEVEL=$level
@@ -257,10 +257,10 @@ then
 			fi
 			if [ $level = $CURLEVEL ]
 			then
-SCRIPTS=$SCRIPTS $(start_test_add $s)
+start_test_add $s
 continue
 			fi
-			SCRIPTS=$SCRIPTS $(start_test_add $s)
+			start_test_add $s
 
 			startup $ACTION $SCRIPTS
 			CURLEVEL=$level
-- 
1.8.5.3

___
Pkg-sysvinit-devel mailing list
Pkg-sysvinit-devel@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-sysvinit-devel

[Pkg-sysvinit-devel] Bug#738759: fix for the bug

2014-02-13 Thread Gerfried Fuchs
tags 738759 + patch
thanks

  Hi!

 Please find attach a proposed patch for the issue.  I hope we can get
around at work to test it properly within the next few days, but from
what I can tell this should be a good approach.

 Enjoy,
Rhonda
-- 
Fühlst du dich mutlos, fass endlich Mut, los  |
Fühlst du dich hilflos, geh raus und hilf, los| Wir sind Helden
Fühlst du dich machtlos, geh raus und mach, los   | 23.55: Alles auf Anfang
Fühlst du dich haltlos, such Halt und lass los|
From e211b7ba4fdce03d66b9edc097349c4d17d94063 Mon Sep 17 00:00:00 2001
From: Gerfried Fuchs rho...@debian.org
Date: Fri, 14 Feb 2014 08:03:25 +0100
Subject: [PATCH] only scan the rcX.d once for reading all kill or all start
 links (closes: #738759)

---
 debian/changelog |   5 ++
 debian/src/sysv-rc/etc/init.d/rc | 138 ++-
 2 files changed, 84 insertions(+), 59 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ac3f0a0..0bff2a4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,13 @@
 sysvinit (2.88dsf-52) UNRELEASED; urgency=low
 
+  [ Petter Reinholdtsen ]
   * Replace debian/watch with file available from
 http://qa.debian.org/cgi-bin/watchfile.cgi?package=sysvinit .
 
+  [ Gerfried Fuchs ]
+  * only scan the rcX.d once for reading all kill or all start links
+(closes: #738759)
+
  -- Petter Reinholdtsen p...@debian.org  Thu, 13 Feb 2014 13:23:35 +0100
 
 sysvinit (2.88dsf-51) unstable; urgency=low
diff --git a/debian/src/sysv-rc/etc/init.d/rc b/debian/src/sysv-rc/etc/init.d/rc
index 4e95302..7767778 100644
--- a/debian/src/sysv-rc/etc/init.d/rc
+++ b/debian/src/sysv-rc/etc/init.d/rc
@@ -124,6 +124,65 @@ case $CONCURRENCY in
 		;;
 esac
 
+# helper scripts
+kill_test_add() {
+	script=$1
+	# Check if the script is there.
+	[ ! -f $script ]  return 
+
+	#
+	# Find stop script in previous runlevel but
+	# no start script there.
+	#
+	suffix=${script#/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 ]  return 
+
+	# Stop the service.
+	return $script
+}
+start_test_add() {
+	script=$1
+	[ ! -f $script ]  return 
+
+	suffix=${script#/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 ]  return 
+		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 ]  return 
+		fi
+
+	fi
+	return $script
+}
+
 # Is there an rc directory for this new runlevel?
 if [ -d /etc/rc$runlevel.d ]
 then
@@ -150,41 +209,28 @@ then
 	then
 		# Run all scripts with the same level in parallel
 		CURLEVEL=
+		SCRIPTS=
 		for s in /etc/rc$runlevel.d/K*
 		do
 			# Extract order value from symlink
 			level=${s#/etc/rc$runlevel.d/K}
 			level=${level%%[a-zA-Z]*}
+			if [ -z $CURLEVEL ]
+			then
+CURLEVEL=$level
+			fi
 			if [ $level = $CURLEVEL ]
 			then
+SCRIPTS=$SCRIPTS $(kill_test_add $s)
 continue
 			fi
-			CURLEVEL=$level
-			SCRIPTS=
-			for i in /etc/rc$runlevel.d/K$level*
-			do
-# 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
+			SCRIPTS=$SCRIPTS $(kill_test_add $s)
 
-# Stop the service.
-SCRIPTS=$SCRIPTS $i
-			done
 			startup stop $SCRIPTS
+			CURLEVEL=$level
+			SCRIPTS=
 		done
+		startup stop $SCRIPTS
 	fi
 
 	if [ makefile = $CONCURRENCY ]
@@ -199,54 +245,28 @@ then
 		# Now run the START scripts for this runlevel.
 		# Run all scripts with the same level in parallel
 		CURLEVEL=
+		SCRIPTS=
 		for s in /etc/rc$runlevel.d/S*
 		do
 			# Extract order value from symlink
 			level=${s#/etc/rc$runlevel.d/S}
 			level=${level%%[a-zA-Z]*}
+			if [ -z $CURLEVEL ]
+			then
+CURLEVEL=$level
+