From 5d6fdbde7b7f962911245acf45d249f728956fda Mon Sep 17 00:00:00 2001 From: Chen Qi Date: Wed, 6 Nov 2013 10:50:43 +0800 Subject: [PATCH] extrausers.bbclass: avoid infinite loop 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. (From OE-Core master rev: bf4fb345a9db306fa4c7211b7e6795334a649dd5) (From OE-Core rev: 05f9c15abb0705cd9f8aa28bfb3016485730b643) Signed-off-by: Chen Qi Signed-off-by: Richard Purdie Signed-off-by: Robert Yang Signed-off-by: Richard Purdie --- meta/classes/extrausers.bbclass | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/meta/classes/extrausers.bbclass b/meta/classes/extrausers.bbclass index 8670a2a85a..faf57b108e 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-`