]> code.ossystems Code Review - openembedded-core.git/commitdiff
extrausers.bbclass: avoid infinite loop
authorChen Qi <Qi.Chen@windriver.com>
Wed, 6 Nov 2013 02:50:43 +0000 (10:50 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 6 Nov 2013 11:01:18 +0000 (11:01 +0000)
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@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/extrausers.bbclass

index 8670a2a85aa24c9037d4ddc0a525a800e2effd89..faf57b108e52865f2e4ac827526021b27bd6c2ca 100644 (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-`