]> code.ossystems Code Review - openembedded-core.git/commitdiff
useradd: Fix infinite build loop
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 29 Sep 2016 01:27:35 +0000 (21:27 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 29 Sep 2016 10:00:45 +0000 (11:00 +0100)
http://git.openembedded.org/openembedded-core-contrib/commit/?id=642c6cf0b6a0371de476513162bd0cefa9c438b3
introduces a problem if the USERADD_PARAM variable has trailing
whitespace as the code infinitely loops causing build hangs.

Add a similar sed expression to $remaining to avoid this.

(From OE-Core rev: d6241e4c94a0a72acfc57e96a59918c0b2146d65)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Signed-off-by: Denys Dmytriyenko <denys@ti.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/useradd.bbclass

index 67dae880b7d49a4ee19eb2e1c40db1e3d2aa59e4..28dd341bf7e8adb4954e0eafbbd88a281421f554 100644 (file)
@@ -55,14 +55,14 @@ if test "x`echo $GROUPADD_PARAM | tr -d '[:space:]'`" != "x"; then
        # Invoke multiple instances of groupadd for parameter lists
        # separated by ';'
        opts=`echo "$GROUPADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
-       remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2-`
+       remaining=`echo "$GROUPADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
        while test "x$opts" != "x"; do
                perform_groupadd "$SYSROOT" "$OPT $opts"
                if test "x$opts" = "x$remaining"; then
                        break
                fi
                opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
-               remaining=`echo "$remaining" | cut -d ';' -f 2-`
+               remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
        done
 fi 
 
@@ -71,14 +71,14 @@ if test "x`echo $USERADD_PARAM | tr -d '[:space:]'`" != "x"; then
        # Invoke multiple instances of useradd for parameter lists
        # separated by ';'
        opts=`echo "$USERADD_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
-       remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2-`
+       remaining=`echo "$USERADD_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
        while test "x$opts" != "x"; do
                perform_useradd "$SYSROOT" "$OPT $opts"
                if test "x$opts" = "x$remaining"; then
                        break
                fi
                opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
-               remaining=`echo "$remaining" | cut -d ';' -f 2-`
+               remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
        done
 fi
 
@@ -87,14 +87,14 @@ if test "x`echo $GROUPMEMS_PARAM | tr -d '[:space:]'`" != "x"; then
        # Invoke multiple instances of groupmems for parameter lists
        # separated by ';'
        opts=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
-       remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2-`
+       remaining=`echo "$GROUPMEMS_PARAM" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
        while test "x$opts" != "x"; do
                perform_groupmems "$SYSROOT" "$OPT $opts"
                if test "x$opts" = "x$remaining"; then
                        break
                fi
                opts=`echo "$remaining" | cut -d ';' -f 1 | sed -e 's#[ \t]*$##'`
-               remaining=`echo "$remaining" | cut -d ';' -f 2-`
+               remaining=`echo "$remaining" | cut -d ';' -f 2- | sed -e 's#[ \t]*$##'`
        done
 fi
 }