[OE-core] [PATCH 1/1] extrausers.bbclass: avoid infinite loop

Qi.Chen at windriver.com Qi.Chen at windriver.com
Wed Nov 6 02:50:43 UTC 2013


From: Chen Qi <Qi.Chen at windriver.com>

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.

Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
---
 meta/classes/extrausers.bbclass |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meta/classes/extrausers.bbclass b/meta/classes/extrausers.bbclass
index 8670a2a..faf57b1 100644
--- a/meta/classes/extrausers.bbclass
+++ b/meta/classes/extrausers.bbclass
@@ -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-`
-- 
1.7.9.5




More information about the Openembedded-core mailing list