All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] useradd: Fix infinite build loop
@ 2016-05-23  9:32 Richard Purdie
  2016-05-23 15:03 ` Khem Raj
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2016-05-23  9:32 UTC (permalink / raw)
  To: openembedded-core

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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
index 67dae88..28dd341 100644
--- a/meta/classes/useradd.bbclass
+++ b/meta/classes/useradd.bbclass
@@ -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
 }




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] useradd: Fix infinite build loop
  2016-05-23  9:32 [PATCH] useradd: Fix infinite build loop Richard Purdie
@ 2016-05-23 15:03 ` Khem Raj
  0 siblings, 0 replies; 2+ messages in thread
From: Khem Raj @ 2016-05-23 15:03 UTC (permalink / raw)
  To: Richard Purdie; +Cc: Patches and discussions about the oe-core layer

[-- Attachment #1: Type: text/plain, Size: 3668 bytes --]

Thanks Richard
On May 23, 2016 2:33 AM, "Richard Purdie" <
richard.purdie@linuxfoundation.org> wrote:

>
> 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.
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>
> diff --git a/meta/classes/useradd.bbclass b/meta/classes/useradd.bbclass
> index 67dae88..28dd341 100644
> --- a/meta/classes/useradd.bbclass
> +++ b/meta/classes/useradd.bbclass
> @@ -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
>  }
>
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 5384 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-05-23 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-23  9:32 [PATCH] useradd: Fix infinite build loop Richard Purdie
2016-05-23 15:03 ` Khem Raj

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.