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 <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Chen Qi 2013-11-06 10:50:43 +08:00 committed by Richard Purdie
parent bd80aac525
commit 5d6fdbde7b
1 changed files with 4 additions and 0 deletions

View File

@ -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-`