Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 1/2] sysvinit: rc: fix inconsistent indentation
@ 2026-08-26  9:00 Nora Schiffer
  2026-08-26  9:00 ` [PATCH 2/2] sysvinit: rc: improve counting of progress steps Nora Schiffer
  0 siblings, 1 reply; 3+ messages in thread
From: Nora Schiffer @ 2026-08-26  9:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: oss, Nora Schiffer

The file was mixing various kinds of whitespace for indentation
including tabs, 2 spaces, 4 spaces and 8 spaces. It also indented some
of its toplevel code with 2 spaces.

Clean it up to use tabs consistently.

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
---
 meta/recipes-core/sysvinit/sysvinit/rc | 122 ++++++++++++-------------
 1 file changed, 61 insertions(+), 61 deletions(-)

diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index 41196ec90b..f1169ec3ac 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -20,16 +20,16 @@ export VERBOSE
 export PSPLASH_FIFO_DIR
 
 startup_progress() {
-    step=$(($step + $step_change))
-    if [ "$num_steps" != "0" ]; then
-        progress=$((($step * $progress_size / $num_steps) + $first_step))
-    else
-        progress=$progress_size
-    fi
-    #echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size"
-    if type psplash-write >/dev/null 2>&1; then
-        psplash-write "PROGRESS $progress" || true
-    fi
+	step=$(($step + $step_change))
+	if [ "$num_steps" != "0" ]; then
+		progress=$((($step * $progress_size / $num_steps) + $first_step))
+	else
+		progress=$progress_size
+	fi
+	#echo "PROGRESS is $progress $runlevel $first_step + ($step of $num_steps) $step_change $progress_size"
+	if type psplash-write >/dev/null 2>&1; then
+		psplash-write "PROGRESS $progress" || true
+	fi
 }
 
 
@@ -37,57 +37,57 @@ startup_progress() {
 # Start script or program.
 #
 startup() {
-  # Handle verbosity
-  [ "$VERBOSE" = very ] && echo "INIT: Running $@..."
-
-  case "$1" in
-	*.sh)
-		# Source shell script for speed.
-		(
-			trap - INT QUIT TSTP
-			scriptname=$1
-			shift
-			. $scriptname
-		)
-		;;
-	*)
-		"$@"
-		;;
-  esac
-  startup_progress
+	# Handle verbosity
+	[ "$VERBOSE" = very ] && echo "INIT: Running $@..."
+
+	case "$1" in
+		*.sh)
+			# Source shell script for speed.
+			(
+				trap - INT QUIT TSTP
+				scriptname=$1
+				shift
+				. $scriptname
+			)
+			;;
+		*)
+			"$@"
+			;;
+	esac
+	startup_progress
 }
 
-  # Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
-  trap ":" INT QUIT TSTP
+# Ignore CTRL-C only in this shell, so we can interrupt subprocesses.
+trap ":" INT QUIT TSTP
 
-  # Set onlcr to avoid staircase effect.
-  stty onlcr 0>&1
+# Set onlcr to avoid staircase effect.
+stty onlcr 0>&1
 
-  # Limit stack size for startup scripts
-  [ "$STACK_SIZE" = "" ] || ulimit -S -s $STACK_SIZE
+# Limit stack size for startup scripts
+[ "$STACK_SIZE" = "" ] || ulimit -S -s $STACK_SIZE
 
-  # Now find out what the current and what the previous runlevel are.
+# Now find out what the current and what the previous runlevel are.
 
-  runlevel=$RUNLEVEL
-  # Get first argument. Set new runlevel to this argument.
-  [ "$1" != "" ] && runlevel=$1
-  if [ "$runlevel" = "" ]
-  then
+runlevel=$RUNLEVEL
+# Get first argument. Set new runlevel to this argument.
+[ "$1" != "" ] && runlevel=$1
+if [ "$runlevel" = "" ]
+then
 	echo "Usage: $0 <runlevel>" >&2
 	exit 1
-  fi
-  previous=$PREVLEVEL
-  [ "$previous" = "" ] && previous=N
+fi
+previous=$PREVLEVEL
+[ "$previous" = "" ] && previous=N
 
-  export runlevel previous
+export runlevel previous
 
-  # Is there an rc directory for this new runlevel?
-  if [ -d /etc/rc$runlevel.d ]
-  then
+# Is there an rc directory for this new runlevel?
+if [ -d /etc/rc$runlevel.d ]
+then
 	# Find out where in the progress bar the initramfs got to.
 	PROGRESS_STATE=0
 	#if [ -f /dev/.initramfs/progress_state ]; then
-	#    . /dev/.initramfs/progress_state
+	#	. /dev/.initramfs/progress_state
 	#fi
 
 	# Split the remaining portion of the progress bar into thirds
@@ -100,7 +100,7 @@ startup() {
 			progress_size=100
 			step_change=1
 			;;
-	        S)
+		S)
 			# Begin where the initramfs left off and use 2/3
 			# of the remaining space
 			first_step=$PROGRESS_STATE
@@ -117,14 +117,14 @@ startup() {
 
 	num_steps=0
 	for s in /etc/rc$runlevel.d/[SK]*; do
-            case "${s##/etc/rc$runlevel.d/S??}" in
-                gdm|xdm|kdm|reboot|halt)
-                    break
-                    ;;
-            esac
-            num_steps=$(($num_steps + 1))
-        done
-        step=0
+		case "${s##/etc/rc$runlevel.d/S??}" in
+			gdm|xdm|kdm|reboot|halt)
+				break
+				;;
+		esac
+		num_steps=$(($num_steps + 1))
+	done
+	step=0
 
 	# First, run the KILL scripts.
 	if [ $previous != N ]
@@ -172,11 +172,11 @@ startup() {
 				;;
 		esac
 	done
-  fi
+fi
 
 #Uncomment to cause psplash to exit manually, otherwise it exits when it sees a VC switch
 if [ "x$runlevel" != "xS" ] && [ ! -x /etc/rc${runlevel}.d/S??xserver-nodm ]; then
-    if type psplash-write >/dev/null 2>&1; then
-        psplash-write "QUIT" || true
-    fi
+	if type psplash-write >/dev/null 2>&1; then
+		psplash-write "QUIT" || true
+	fi
 fi
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] sysvinit: rc: improve counting of progress steps
  2026-08-26  9:00 [PATCH 1/2] sysvinit: rc: fix inconsistent indentation Nora Schiffer
@ 2026-08-26  9:00 ` Nora Schiffer
  2026-10-20 13:57   ` [OE-core] " Mathieu Dubois-Briand
  0 siblings, 1 reply; 3+ messages in thread
From: Nora Schiffer @ 2026-08-26  9:00 UTC (permalink / raw)
  To: openembedded-core; +Cc: oss, Nora Schiffer

Fix a number of issues that caused more steps to be counted than calls
to startup_progress would happen in some situations, resulting in the
progress bar never reaching 100%:

- Use the same conditions when looping over initscripts for counting
  steps that are also used for running them
- When skipping a script, run startup_progress to avoid off-by-one

Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
---
 meta/recipes-core/sysvinit/sysvinit/rc | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/meta/recipes-core/sysvinit/sysvinit/rc b/meta/recipes-core/sysvinit/sysvinit/rc
index f1169ec3ac..d66a7cf1b0 100755
--- a/meta/recipes-core/sysvinit/sysvinit/rc
+++ b/meta/recipes-core/sysvinit/sysvinit/rc
@@ -116,8 +116,18 @@ then
 	esac
 
 	num_steps=0
-	for s in /etc/rc$runlevel.d/[SK]*; do
-		case "${s##/etc/rc$runlevel.d/S??}" in
+	if [ $previous != N ]
+	then
+		for i in /etc/rc$runlevel.d/K[0-9][0-9]*
+		do
+			[ ! -f $i ] && continue
+			num_steps=$(($num_steps + 1))
+		done
+	fi
+	for i in /etc/rc$runlevel.d/S*
+	do
+		[ ! -f $i ] && continue
+		case "${i##/etc/rc$runlevel.d/S??}" in
 			gdm|xdm|kdm|reboot|halt)
 				break
 				;;
@@ -158,7 +168,11 @@ then
 			# and _no_ stop script in this level, we don't
 			# have to re-start the service.
 			#
-			[ -f $previous_start ] && [ ! -f $stop ] && continue
+			if [ -f $previous_start ] && [ ! -f $stop ]
+			then
+				startup_progress
+				continue
+			fi
 		fi
 		if [ x"${PSPLASH_TEXT_UPDATES}" = x"yes" ]; then
 			psplash-write "MSG $(basename $i .sh | cut -c 4-)" || true
-- 
TQ-Systems GmbH | Mühlstraße 2, Gut Delling | 82229 Seefeld, Germany
Amtsgericht München, HRB 105018
Geschäftsführer: Detlef Schneider, Rüdiger Stahl, Stefan Schneider
https://www.tq-group.com/



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [OE-core] [PATCH 2/2] sysvinit: rc: improve counting of progress steps
  2026-08-26  9:00 ` [PATCH 2/2] sysvinit: rc: improve counting of progress steps Nora Schiffer
@ 2026-10-20 13:57   ` Mathieu Dubois-Briand
  0 siblings, 0 replies; 3+ messages in thread
From: Mathieu Dubois-Briand @ 2026-10-20 13:57 UTC (permalink / raw)
  To: nora.schiffer, openembedded-core; +Cc: oss

On Wed Aug 26, 2026 at 11:00 AM CEST, Nora Schiffer via lists.openembedded.org wrote:
> Fix a number of issues that caused more steps to be counted than calls
> to startup_progress would happen in some situations, resulting in the
> progress bar never reaching 100%:
>
> - Use the same conditions when looping over initscripts for counting
>   steps that are also used for running them
> - When skipping a script, run startup_progress to avoid off-by-one
>
> Signed-off-by: Nora Schiffer <nora.schiffer@ew.tq-group.com>
> ---

I was not able to reproduce the original issue of a progress bar never
reaching 100%, yet these changes are not breaking anything.

The code changes look sane.

So the whole patch looks good to me.

-- 
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-20 13:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-26  9:00 [PATCH 1/2] sysvinit: rc: fix inconsistent indentation Nora Schiffer
2026-08-26  9:00 ` [PATCH 2/2] sysvinit: rc: improve counting of progress steps Nora Schiffer
2026-10-20 13:57   ` [OE-core] " Mathieu Dubois-Briand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox