From: Chen Qi Date: Wed, 6 Nov 2013 02:50:43 +0000 (+0800) Subject: extrausers.bbclass: avoid infinite loop X-Git-Tag: lucaceresoli/bug-15201-perf-libtraceevent-missing~35531 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf4fb345a9db306fa4c7211b7e6795334a649dd5;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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. Signed-off-by: Chen Qi Signed-off-by: Richard Purdie --- diff --git a/meta/classes/extrausers.bbclass b/meta/classes/extrausers.bbclass index 8670a2a85aa..faf57b108e5 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-`