Skip to contentSkip to conversation

extrausers.bbclass: avoid infinite loop

PATCH New [email protected] 1 participant 2 messages Nov 6, 2013

lore
Share & tools
lore
#0 lore raw

cover extrausers.bbclass: avoid infinite loop

From: Chen Qi <[email protected]>

The following changes since commit 3e6b57fcfea93fbefd746ba056410409b35c5523:

mdadm: Disable the RUN_DIR check (2013-11-05 22:24:46 +0000)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib ChenQi/extrausers-loop
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/extrausers-loop

Chen Qi (1):
extrausers.bbclass: avoid infinite loop

 meta/classes/extrausers.bbclass |    4 ++++
 1 file changed, 4 insertions(+)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 extrausers.bbclass: avoid infinite loop

From: Chen Qi <[email protected]>

Avoid infinite loop if the last record in EXTRA_USRES_PARAMS doesn't end with a semicolon.

It's possible the the users will write configurations like below.

INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "useradd tester; useradd developer"

In such situation, the do_rootfs task will enter an infinite loop. An infinite loop is never acceptable.

This patch fixes the above problem.

---
 meta/classes/extrausers.bbclass |    4 ++++
 1 file changed, 4 insertions(+)
meta/classes/extrausers.bbclass +4 -0
index 8670a2a..faf57b1 100644
@@ -54,6 +54,10 @@ set_user_group () {
 				bbfatal "Invalid command in EXTRA_USERS_PARAMS: $cmd"
 				;;
 		esac
+		# Avoid infinite loop if the last parameter doesn't end with ';'
+		if [ "$setting" = "$remaining" ]; then
+			break
+		fi
 		# iterate to the next setting
 		setting=`echo $remaining | cut -d ';' -f1`
 		remaining=`echo $remaining | cut -d ';' -f2-`
Signature · 1 line
1.7.9.5